<!DOCTYPE html>
<html>
  <!-- meta/link... -->
  



<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  <!-- Global site tag (gtag.js) - Google Analytics -->


  <title>Linux学习笔记 | YY&#39;s Blog</title>

  <link rel="icon" type="image/jpeg" href="/medias/favicon.jpg">
  <link rel="stylesheet" href="https://at.alicdn.com/t/font_1911880_c1nvbyezg17.css">
  <link href="https://unpkg.com/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet">
  <link href="/js/swiper/swiper@5.4.1.min.css" rel="stylesheet">
  
  
  
  
<link rel="stylesheet" href="/css/animate.min.css">

  
<link rel="stylesheet" href="/css/style.css">

  
  
    
<link rel="stylesheet" href="/js/fancybox/jquery.fancybox.min.css">

  
  
    
<link rel="stylesheet" href="/js/shareJs/share.min.css">

  
  <style>
        @media (max-width: 992px) {
            #waifu {
                display: none;
            }
        }
    </style>
    <script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
    <link href="//cdn.bootcss.com/pace/1.0.2/themes/pink/pace-theme-flash.css" rel="stylesheet">

    
        <script src="/js/valine/index.js"></script>
    

    <!-- import link -->
    
        
            
        
            
        
    
    <!-- import script -->
    
        
            <script>function blog_time() {window.setTimeout(blog_time,1000);const now = new Date();const copyrightTime = now.getFullYear();			display_copyright_time.innerHTML = " "+copyrightTime;}blog_time();</script>
        
            <script>function blog_live_time() {window.setTimeout(blog_live_time, 1000);const start = new Date('2020-10-01T00:00:00');const now = new Date();const timeDiff = (now.getTime() - start.getTime());					  const msPerMinute = 60 * 1000;					  const msPerHour = 60 * msPerMinute;					  const msPerDay = 24 * msPerHour;					  const passDay = Math.floor(timeDiff / msPerDay);					  const passHour = Math.floor((timeDiff % msPerDay) / 60 / 60 / 1000);					  const passMinute = Math.floor((timeDiff % msPerHour) / 60 / 1000);const passSecond = Math.floor((timeDiff % msPerMinute) / 1000);display_live_time.innerHTML = " " + passDay + " 天 " + passHour + " 小时 " + passMinute + " 分 " + passSecond + " 秒";}blog_live_time();</script>
        
    

    <!-- import daovoice -->
    

        <script>(function (i, s, o, g, r, a, m) {
            i['DaoVoiceObject'] = r;
            i[r] = i[r] ||
              function () {
                (i[r].q = i[r].q || []).push(arguments);
              };
            i[r].l = 1 * new Date();
            a = s.createElement(o);
            m = s.getElementsByTagName(o)[0];
            a.async = 1;
            a.src = g;
            a.charset = 'utf-8';
            m.parentNode.insertBefore(a, m);
          })(window, document, 'script', ('https:' === document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/5a027b89.js", 'daovoice');
          daovoice('init', {
            app_id: "5a027b89",
          });
          daovoice('update');
        </script>
      
    
<meta name="generator" content="Hexo 5.4.0"></head>

  
  <!-- 依赖于jquery和vue -->
  
    
<script src="https://unpkg.com/jquery@3.5.1/dist/jquery.min.js"></script>

  

  
    
<script src="https://unpkg.com/vue@2.6.11/dist/vue.min.js"></script>

  
  
  <body>
    <!-- 预加载动画 -->
    <!-- 页面预加载动画 -->

<div id='loader'>
  <link rel="stylesheet" href="/js/loaded/index.css" >
  <div class="loading-left-bg"></div>
  <div class="loading-right-bg"></div>
  <div class="spinner-box">
    <div class="configure-border-1">
      <div class="configure-core"></div>
    </div>
    <div class="configure-border-2">
      <div class="configure-core"></div>
    </div>
    <div class="loading-word">加载中...</div>
  </div>
</div>

<script>
  var endLoading = function () {
    document.body.style.overflow = 'auto';
    document.getElementById('loader').classList.add("loading");
  }
  window.addEventListener('DOMContentLoaded',endLoading);
  
</script>

    
    <!-- 判断是否为暗黑风格 -->
    <!-- 判断是否为黑夜模式 -->
<script>
  let isDark = JSON.parse(localStorage.getItem('dark')) || JSON.parse('false');

  if (isDark) {
    $(document.body).addClass('darkModel');
  }
</script>

    <!-- 需要在上面加载的js -->
    <script>
  function loadScript(src, cb) {
    return new Promise(resolve => {
      setTimeout(function () {
        var HEAD = document.getElementsByTagName("head")[0] || document.documentElement;
        var script = document.createElement("script");
        script.setAttribute("type", "text/javascript");
        if (cb) {
          if (JSON.stringify(cb)) {
            for (let p in cb) {
              if (p == "onload") {
                script[p] = () => {
                  cb[p]()
                  resolve()
                }
              } else {
                script[p] = cb[p]
                script.onload = resolve
              }
            }
          } else {
            script.onload = () => {
              cb()
              resolve()
            };
          }
        } else {
          script.onload = resolve
        }
        script.setAttribute("src", src);
        HEAD.appendChild(script);
      });
    });
  }

  //https://github.com/filamentgroup/loadCSS
  var loadCSS = function (href, before, media, attributes) {
    return new Promise(resolve => {
      setTimeout(function () {
        var link = document.createElement('link');
        link.rel = "stylesheet";
        link.href = src;
        link.onload = resolve;
        document.getElementsByTagName("head")[0].appendChild(link);
      });
    });
  };

</script> 

<!-- 轮播图所需要的js -->
<script src="/js/swiper/swiper.min.js"></script>
<script src="/js/swiper/vue-awesome-swiper.js"></script>
<script src="/js/swiper/swiper.animate1.0.3.min.js"></script>

<script type="text/javascript">
  Vue.use(window.VueAwesomeSwiper)
</script>


  <script src="/js/vue-typed-js/index.js"></script>


<!-- 首页的公告滚动插件的js需要重新加载 -->
<script src="/js/vue-seamless-scroll/index.js"></script>

<!-- 打字机效果js -->
<script src="https://unpkg.com/typed.js@2.0.11"></script>


    <div id="safearea">
      <main class="main" id="pjax-container">
        <!-- 头部导航 -->
        
<header class="header   " 
  id="navHeader"
  style="position: fixed;
  left: 0; top: 0; z-index: 10;width: 100%;"
>
  <div class="header-content">
    <div class="bars">
      <div id="appDrawer" class="sidebar-image">
  <div class="drawer-box-icon">
    <i class="fas fa-bars" aria-hidden="true" @click="showDialogDrawer"></i>
  </div>
  
  <transition name="fade">
    <div class="drawer-box_mask" v-cloak style="display: none;" v-show="visible" @click.self="cancelDialogDrawer">
    </div>
  </transition>
  <div class="drawer-box" :class="{'active': visible}">
    <div class="drawer-box-head bg-color">
      <img class="drawer-box-head_logo lazyload placeholder" src="/medias/logo.png" class="lazyload placeholder" data-srcset="/medias/logo.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="logo">
      <h3 class="drawer-box-head_title">YY&#39;s Blog</h3>
      <h5 class="drawer-box-head_desc">三十年河东，三十年河西，莫欺少年穷！</h5>
    </div>
    
    <div class="drawer-box-content">
      <ul class="drawer-box-content_menu">
        
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/" class="drawer-menu-item-link">
                  
                    <i class="fa fa-home" aria-hidden="true"></i>
                  
                  <span class="name">首页</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/archives" class="drawer-menu-item-link">
                  
                    <i class="fa fa-archive" aria-hidden="true"></i>
                  
                  <span class="name">归档</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/tags" class="drawer-menu-item-link">
                  
                    <i class="fa fa-tags" aria-hidden="true"></i>
                  
                  <span class="name">标签</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/categories" class="drawer-menu-item-link">
                  
                    <i class="fa fa-bookmark" aria-hidden="true"></i>
                  
                  <span class="name">分类</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/about" class="drawer-menu-item-link">
                  
                    <i class="fa fa-user" aria-hidden="true"></i>
                  
                  <span class="name">关于</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/comments" class="drawer-menu-item-link">
                  
                    <i class="fa fa-comments" aria-hidden="true"></i>
                  
                  <span class="name">留言</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/friends" class="drawer-menu-item-link">
                  
                    <i class="fa fa-book" aria-hidden="true"></i>
                  
                  <span class="name">友情链接</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/love" class="drawer-menu-item-link">
                  
                    <i class="fa fa-heart" aria-hidden="true"></i>
                  
                  <span class="name">Love</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="javascript:;" class="drawer-menu-item-link has-children" @click="openOrCloseMenu(8)">
                  <span>
                    
                      <i class="fa fa-link"></i>
                    
                    <span class="name">更多</span>
                  </span>
                  <i class="fas fa-chevron-left arrow " :class="{'icon-rotate': isOpen(8)}" aria-hidden="true"></i>
                </a>
                <ul class="drawer-sub-menu" v-if="isOpen(8)">
                  
                  <li>
                    <a href="/gallery">
                      
                      <i class="fa fa-music" style="margin-top: -20px;"></i>
                      
                      <span>图库</span>
                    </a>
                  </li>
                  
                  <li>
                    <a href="/me">
                      
                      <i class="fa fa-user" style="margin-top: -20px;"></i>
                      
                      <span>关于我</span>
                    </a>
                  </li>
                  
                  <li>
                    <a href="/resources">
                      
                      <i class="fa fa-film" style="margin-top: -20px;"></i>
                      
                      <span>资源</span>
                    </a>
                  </li>
                  
                  <li>
                    <a target="_blank" rel="noopener" href="http://baidu.com">
                      
                      <i class="fa fa-wifi" style="margin-top: -20px;"></i>
                      
                      <span>百度</span>
                    </a>
                  </li>
                  
                </ul>
              
            </li>
          
        
        
          <li class="drawer-box-content_item">
            <a target="_blank" rel="noopener" href="https://gitee.com/yangyang-linux">
              <i class="fas fa-github" aria-hidden="true"></i>
              <span>Github</span>
            </a>
          </li>
        
      </ul>
    </div>
  </div>
</div>

<script>
  var body = document.body || document.documentElement || window;
  var vm = new Vue({
    el: '#appDrawer',
    data: {
      visible: false,
      top: 0,
      openArr: [],
    },
    computed: {
    },
    mounted() {
    },
    methods: {
      isOpen(index) {
        if (this.openArr.includes(index)) {
          return true;
        } else {
          return false;
        }
      },
      openOrCloseMenu(curIndex) {
        const index = this.openArr.indexOf(curIndex);
        if (index !== -1) {
          this.openArr.splice(index, 1);
        } else {
          this.openArr.push(curIndex);
        }
      },
      showDialogDrawer() {
        this.visible = true;
        // 防止页面滚动，只能让弹框滚动
        this.top = $(document).scrollTop()
        body.style.cssText = 'width: 100%; height: 100%;overflow: hidden;';
      },
      cancelDialogDrawer() {
        this.visible = false;
        body.removeAttribute('style');
        $(document).scrollTop(this.top)
      }
    },
    created() {}
  })
</script>

    </div>
    <div class="blog-title" id="author-avatar">
      
        <div class="avatar">
          <img src="/medias/logo.png" class="lazyload placeholder" data-srcset="/medias/logo.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="logo">
        </div>
      
      <a href="/" class="logo">YY&#39;s Blog</a>
    </div>
    <nav class="navbar">
      <ul class="menu">
        
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/" class="menu-item-link" title="首页">
                  
                    <i class="fa fa-home" aria-hidden="true"></i>
                  
                  <span class="name">首页</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/archives" class="menu-item-link" title="归档">
                  
                    <i class="fa fa-archive" aria-hidden="true"></i>
                  
                  <span class="name">归档</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/tags" class="menu-item-link" title="标签">
                  
                    <i class="fa fa-tags" aria-hidden="true"></i>
                  
                  <span class="name">标签</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/categories" class="menu-item-link" title="分类">
                  
                    <i class="fa fa-bookmark" aria-hidden="true"></i>
                  
                  <span class="name">分类</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/about" class="menu-item-link" title="关于">
                  
                    <i class="fa fa-user" aria-hidden="true"></i>
                  
                  <span class="name">关于</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/comments" class="menu-item-link" title="留言">
                  
                    <i class="fa fa-comments" aria-hidden="true"></i>
                  
                  <span class="name">留言</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/friends" class="menu-item-link" title="友情链接">
                  
                    <i class="fa fa-book" aria-hidden="true"></i>
                  
                  <span class="name">友情链接</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/love" class="menu-item-link" title="Love">
                  
                    <i class="fa fa-heart" aria-hidden="true"></i>
                  
                  <span class="name">Love</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="javascript:;" class="menu-item-link" title="更多">
                  
                    <i class="fa fa-link"></i>
                  
                  <span class="name">更多</span>
                  <i class="fas fa-chevron-down arrow" aria-hidden="true"></i>
                </a>
                <ul class="sub-menu">
                  
                  <li>
                    <a href="/gallery">
                      
                      <i class="fa fa-music" style="margin-top: -20px;"></i>
                      
                      <span>图库</span>
                    </a>
                  </li>
                  
                  <li>
                    <a href="/me">
                      
                      <i class="fa fa-user" style="margin-top: -20px;"></i>
                      
                      <span>关于我</span>
                    </a>
                  </li>
                  
                  <li>
                    <a href="/resources">
                      
                      <i class="fa fa-film" style="margin-top: -20px;"></i>
                      
                      <span>资源</span>
                    </a>
                  </li>
                  
                  <li>
                    <a target="_blank" rel="noopener" href="http://baidu.com">
                      
                      <i class="fa fa-wifi" style="margin-top: -20px;"></i>
                      
                      <span>百度</span>
                    </a>
                  </li>
                  
                </ul>
              
            </li>
          
        
      </ul>
      
      
        <div id="appSearch">
  <div class="search"  @click="showDialog()"><i class="fas fa-search" aria-hidden="true"></i></div>
  <transition name="fade">
    <div class="message-box_wrapper" style="display: none;" v-cloak v-show="dialogVisible" @click.self="cancelDialogVisible()">
      <div class="message-box animated bounceInDown">
        <h2>
          <span>
            <i class="fas fa-search" aria-hidden="true"></i>
            <span class="title">本地搜索</span>
          </span>
          <i class="fas fa-times close" pointer style="float:right;" aria-hidden="true" @click.self="cancelDialogVisible()"></i>
        </h2>
        <form class="site-search-form">
          <input type="text"
            placeholder="请输入关键字"
            id="local-search-input" 
            @click="getSearchFile()"
            class="st-search-input"
            v-model="searchInput"
          />
        </form>
        <div class="result-wrapper">
          <div id="local-search-result" class="local-search-result-cls"></div>
        </div>
      </div>
    </div>
  </transition>
</div>
<script src="/js/local_search.js"></script>
<script>
  var body = document.body || document.documentElement || window;
  var vm = new Vue({
    el: '#appSearch',
    data: {
      dialogVisible: false,
      searchInput: '',
      top: 0,
    },
    computed: {
    },
    mounted() {
      window.addEventListener('pjax:complete', () => {
        this.cancelDialogVisible();
      })
    },
    methods: {
      showDialog() {
        this.dialogVisible = true;
        // 防止页面滚动，只能让弹框滚动
        this.top = $(document).scrollTop()
        body.style.cssText = 'overflow: hidden;';
      },
      getSearchFile() {
        if (!this.searchInput) {
          getSearchFile("/search.xml");
        }
      },
      cancelDialogVisible() {
        this.dialogVisible = false;
        body.removeAttribute('style');
        $(document).scrollTop(this.top)
      },
    },
    created() {}
  })
</script>
<!-- 解决刷新页面闪烁问题，可以在元素上添加display: none, 或者用vue.extend方法，详情：https://blog.csdn.net/qq_31393401/article/details/81017912 -->
<!-- 下面是搜索基本写法 -->
<!-- <script type="text/javascript" id="local.search.active">
  var inputArea = document.querySelector("#local-search-input");
  inputArea.onclick   = function(){ getSearchFile(); this.onclick = null }
  inputArea.onkeydown = function(){ if(event.keyCode == 13) return false }
</script> -->

      

    </nav>
  </div>
  
    <a target="_blank" rel="noopener" href="https://gitee.com/yangyang-linux" class="github-corner color-primary" aria-label="View source on GitHub"><svg width="60" height="60" viewBox="0 0 250 250" style="fill:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
  
  
    <div id="he-plugin-simple"></div>
    <script>
      WIDGET = {
        CONFIG: {
          "modules": "012",
          "background": 5,
          "tmpColor": "4A4A4A",
          "tmpSize": 16,
          "cityColor": "4A4A4A",
          "citySize": 16,
          "aqiSize": 16,
          "weatherIconSize": 24,
          "alertIconSize": 18,
          "padding": "10px 10px 10px 10px",
          "shadow": "1",
          "language": "auto",
          "borderRadius": 5,
          "fixed": "false",
          "vertical": "middle",
          "horizontal": "center",
          "key": "2784dd3fcb1e4f0f9a9b579bf69641f2"
        }
      }
    </script>
    <script src="https://widget.qweather.net/simple/static/js/he-simple-common.js?v=2.0"></script> 
    
</header>
        <!-- 内容区域 -->
        
 <!-- prismjs 代码高亮 -->
 


<div class="bg-dark-floor" style="position: fixed;left: 0;top: 0;width: 100%;height: 100%;z-index: -1;"></div>


  <!-- 文章详情页顶部图片和标题 -->




<div class="post-detail-header" id="thumbnail_canvas" style="background-repeat: no-repeat; background-size: cover; 
  background-position: center center;position: relative;background-image:url('https://pic4.zhimg.com/80/v2-5c062983ace7db9601880019190fb5a8_1440w.jpg')">
  <div class="post-detail-header-mask"></div>
  <canvas id="header_canvas"style="position:absolute;bottom:0;pointer-events:none;"></canvas>
  
  <div class="post-detail-header_info-box">
    <div class="title-box">
      <span class="title">
        Linux学习笔记
      </span>
    </div>
    
    
      
        <span class="post-detail-header_date">
          <i class="fas fa-calendar"></i> 发表于：2021-09-14 |
        </span>
      

      
        <span class="post-detail-header_categories">
          <i class="iconfont iconbookmark1"></i> 分类：
          
            <a href="/categories/linux/" class="post-detail-header_category">
              linux
            </a>
          
        </span>
      

      
        <div class="post-detail-header_wordcount">
          <span class="totalcount">
            <i class="fas fa-file-text-o"></i> 字数统计: 5.5k |
          </span>
  
          <span class="min2read">
            <i class="fas fa-clock"></i> 阅读时长: 21分钟 |
          </span>
  
          
            <span class="reading">
              <i class="fas fa-eye"></i> 阅读量：<span id="busuanzi_value_page_pv"></span>
            </span>
          
        </div>
      
    
  </div>
  
  
    <script src="/js/bubble/bubble.js"></script>
  
</div>





<div class="row justify-position" 
  style="padding-top: 0px;">
  <div class="main-content">
    <article class="post post-detail">
      <div class="post-content">
        <h1 id="Linux介绍"><a href="#Linux介绍" class="headerlink" title="Linux介绍"></a>Linux介绍</h1><ul>
<li>Windows的不足<ul>
<li>Windows收费</li>
<li>系统长时间运行，安装多了，系统越来越慢，越来越不稳定</li>
<li>病毒和流氓软件很多</li>
</ul>
</li>
<li>Linux的优势<ul>
<li>Linux系统免费，很多还是开源的</li>
<li>长时间运行很稳定</li>
<li>几乎没有病毒和流氓软件</li>
</ul>
</li>
</ul>
<h2 id="学习Linux的好处"><a href="#学习Linux的好处" class="headerlink" title="学习Linux的好处"></a>学习Linux的好处</h2><p>学会对Linux的基本操作是后端JavaEE程序员的必修课。做为一个后端JavaEE程序员，通常在Windows中开发完程序后，需要部署到一个相对比较安全，稳定的服务器中运行，这台服务器上安装的往往不是Windows操作系统，而是Linux操作系统。</p>
<p>windows默认安装完成软件就可以连外网，linux默认安装完软件是不可以连外网，必须防火墙放过才可以</p>
<h3 id="linux的概述"><a href="#linux的概述" class="headerlink" title="linux的概述"></a>linux的概述</h3><p>Linux(linux is not unix)是基于Unix的开源、免费、多用户、多任务的操作系统，由于系统的稳定性和安全性。几乎成为程序代码运行的最佳系统环境。</p>
<h3 id="linux的分类"><a href="#linux的分类" class="headerlink" title="linux的分类"></a>linux的分类</h3><ul>
<li><p>按照市场的需求不同</p>
<ul>
<li>图形界面</li>
<li>字符界面(推荐)，特点：性能最优</li>
</ul>
</li>
<li><p>按照原生程度不同</p>
<ul>
<li><p>内核版，linux之父（托瓦兹）团队开发</p>
<ul>
<li><p>特点：免费</p>
<p> 功能：主要解决操作系统底层，操作内存，cpu，硬盘，网卡。。。</p>
</li>
</ul>
</li>
<li><p>发行版（推荐使用）</p>
<ul>
<li>是第三方个人或组织在内核基础上进行二次开发（包装）</li>
<li> 特点：功能应用更多，偏向应用，大多数发行版都是免费的</li>
</ul>
</li>
</ul>
</li>
</ul>
<h1 id="Linux安装"><a href="#Linux安装" class="headerlink" title="Linux安装"></a>Linux安装</h1><p>两种安装方式</p>
<ul>
<li>在PC电脑上进行安装</li>
<li>使用虚拟机安装</li>
</ul>
<p>常见虚拟机软件</p>
<ul>
<li>VMWare 软件,威睿公司，收费的（推荐使用，可以试用）</li>
<li>VirtualBox软件，免费的， 最开始是sun公司，由于被oracle收购了，所以目前属于oracle</li>
</ul>
<h1 id="windows主机连接linux虚拟机与虚拟机网卡介绍"><a href="#windows主机连接linux虚拟机与虚拟机网卡介绍" class="headerlink" title="windows主机连接linux虚拟机与虚拟机网卡介绍"></a>windows主机连接linux虚拟机与虚拟机网卡介绍</h1><table>
<thead>
<tr>
<th align="left">命令</th>
<th align="left">含义</th>
</tr>
</thead>
<tbody><tr>
<td align="left">ifconfig</td>
<td align="left">linux系统用于查看ip地址信息</td>
</tr>
<tr>
<td align="left">ip addr</td>
<td align="left">linux系统用于查看ip地址信息</td>
</tr>
</tbody></table>
<p>在windows主机上使用dos命令ping进行ping通linux系统</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ping www.mobaijun.com</span><br></pre></td></tr></table></figure>

<h1 id="使用客户端工具连接linux系统"><a href="#使用客户端工具连接linux系统" class="headerlink" title="使用客户端工具连接linux系统"></a>使用客户端工具连接linux系统</h1><h2 id="常见的客户端软件"><a href="#常见的客户端软件" class="headerlink" title="常见的客户端软件"></a>常见的客户端软件</h2><p> SecureCRT(操作客户端命令)，SecureFx（用于传输文件）</p>
<p> XShell(操作客户端命令)，XFtp（用于传输文件）【推荐使用，但是收费】</p>
<h1 id="目录操作"><a href="#目录操作" class="headerlink" title="目录操作"></a>目录操作</h1><h2 id="目录结构"><a href="#目录结构" class="headerlink" title="目录结构"></a>目录结构</h2><blockquote>
<p>linux系统没有盘符，一切从根目录/开始，如下图</p>
</blockquote>
<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914165354991.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914165354991.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914165354991"></p>
<blockquote>
<p> 根目录下所有子目录</p>
</blockquote>
<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914165441158.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914165441158.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914165441158"></p>
<h2 id="常见的目录配置"><a href="#常见的目录配置" class="headerlink" title="常见的目录配置"></a>常见的目录配置</h2><table>
<thead>
<tr>
<th align="left">目录</th>
<th align="left">含义</th>
</tr>
</thead>
<tbody><tr>
<td align="left">bin目录</td>
<td align="left">存放着所有linux系统的命令</td>
</tr>
<tr>
<td align="left">root目录</td>
<td align="left">超级管理员root用户的主目录</td>
</tr>
<tr>
<td align="left">home目录</td>
<td align="left">存放所有普通用户主目录的位置</td>
</tr>
<tr>
<td align="left">usr目录</td>
<td align="left">（unix shared resources）资源共享目录，所有用户都可以操作的目录，以后我们安装软件就安装到这里usr/local,这样所有用户都可以使用软件</td>
</tr>
<tr>
<td align="left">etc目录</td>
<td align="left">存储配置文件的目录，以后网卡配置文件，权限配置文件都在这里</td>
</tr>
</tbody></table>
<h2 id="目录操作—切换—创建—查看"><a href="#目录操作—切换—创建—查看" class="headerlink" title="目录操作—切换—创建—查看"></a>目录操作—切换—创建—查看</h2><table>
<thead>
<tr>
<th align="left">作用</th>
<th align="left">改变目录/CD和目录名直接需要空格</th>
</tr>
</thead>
<tbody><tr>
<td align="left">/</td>
<td align="left">切换到根目录</td>
</tr>
<tr>
<td align="left">.</td>
<td align="left">当前目录</td>
</tr>
<tr>
<td align="left">..</td>
<td align="left">上一级目录</td>
</tr>
<tr>
<td align="left">~</td>
<td align="left">返回当前用户主目录</td>
</tr>
<tr>
<td align="left">-</td>
<td align="left">返回上一次目录</td>
</tr>
</tbody></table>
<h2 id="创建目录"><a href="#创建目录" class="headerlink" title="创建目录"></a>创建目录</h2><table>
<thead>
<tr>
<th align="left">mkdir 目录名称</th>
<th align="left">创建一个目录</th>
</tr>
</thead>
<tbody><tr>
<td align="left">mkdir -p</td>
<td align="left">创建多级目录</td>
</tr>
</tbody></table>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mkdir -p /父目录名称/子目录名称</span><br></pre></td></tr></table></figure>

<blockquote>
<p>-p，如果父目录不存在会先创建父目录再创建子目录</p>
</blockquote>
<h2 id="查看目录内容"><a href="#查看目录内容" class="headerlink" title="查看目录内容"></a>查看目录内容</h2><table>
<thead>
<tr>
<th align="left">ls参数</th>
<th align="left">显示当前目录下的文件和目录</th>
</tr>
</thead>
<tbody><tr>
<td align="left">-l</td>
<td align="left">以详细的方式显示当前目录下的文件和目录</td>
</tr>
<tr>
<td align="left">-a</td>
<td align="left">显示当前目录下的所有文件和目录,包含隐藏目录,.XXX开头的文件和目录是隐藏的</td>
</tr>
</tbody></table>
<blockquote>
<p><code>ls -l</code>也等价于 <code>ll</code></p>
<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914165836418.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914165836418.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914165836418"></p>
</blockquote>
<h2 id="目录操作搜索—重命名—复制—删除—帮助"><a href="#目录操作搜索—重命名—复制—删除—帮助" class="headerlink" title="目录操作搜索—重命名—复制—删除—帮助"></a>目录操作搜索—重命名—复制—删除—帮助</h2><table>
<thead>
<tr>
<th align="left">find</th>
<th align="left">[目录名称] [-name’查询字符串’]</th>
</tr>
</thead>
<tbody><tr>
<td align="left">无参数</td>
<td align="left">搜索当前目录和它的子目录所有文件和目录</td>
</tr>
<tr>
<td align="left">目录名称</td>
<td align="left">搜索指定目录下和他的子目录所有的文件和目录</td>
</tr>
<tr>
<td align="left">-name ‘查询字符串’</td>
<td align="left">指定具体查询字符串</td>
</tr>
<tr>
<td align="left"></td>
<td align="left">*匹配多个字符串</td>
</tr>
<tr>
<td align="left"></td>
<td align="left">?匹配一个字符</td>
</tr>
</tbody></table>
<h2 id="重命名与移动"><a href="#重命名与移动" class="headerlink" title="重命名与移动"></a>重命名与移动</h2><ul>
<li>重命名</li>
</ul>
<table>
<thead>
<tr>
<th align="left">move=mv</th>
</tr>
</thead>
<tbody><tr>
<td align="left">mv 旧名称 新名称</td>
</tr>
<tr>
<td align="left">mv既可以改文件也可以改目录</td>
</tr>
</tbody></table>
<ul>
<li>移动</li>
</ul>
<table>
<thead>
<tr>
<th align="left">mv 源目录 目标目录</th>
</tr>
</thead>
<tbody><tr>
<td align="left">mv将源目录移动到目标目录下</td>
</tr>
</tbody></table>
<ul>
<li>复制</li>
</ul>
<table>
<thead>
<tr>
<th align="left">cp [参数] 源文件或目录 目标目录</th>
<th>将源文件或整个目录复制到目标目录下</th>
</tr>
</thead>
<tbody><tr>
<td align="left">-r recursion连同子目录下所有文件全部复制</td>
<td></td>
</tr>
</tbody></table>
<ul>
<li>删除</li>
</ul>
<table>
<thead>
<tr>
<th align="left">rm</th>
<th align="left">参数 文件或目录1 文件或目录2</th>
<th>可以同时指定多个文件或目录</th>
</tr>
</thead>
<tbody><tr>
<td align="left">-r</td>
<td align="left">recursion 连同子目录一起删除,只用来删除目录</td>
<td></td>
</tr>
<tr>
<td align="left">-f</td>
<td align="left">强制删除,删除之前会确认,需要回答yes/no</td>
<td></td>
</tr>
</tbody></table>
<blockquote>
<p>注意：千万不要rm -rf /* 会导致删除所有的文件或目录，导致系统崩溃了</p>
</blockquote>
<ul>
<li>查看帮助文档<ul>
<li>命令 –help 查看英文文档手册，使用q退出</li>
<li>man 命令 查看中文文档手册【推荐方式】，使用q退出</li>
</ul>
</li>
</ul>
<h2 id="创建文件与查看文件内容"><a href="#创建文件与查看文件内容" class="headerlink" title="创建文件与查看文件内容"></a>创建文件与查看文件内容</h2><table>
<thead>
<tr>
<th align="left">touch 文件1 文件2</th>
<th align="left">创建一个或多个文件【0字节大小】</th>
</tr>
</thead>
<tbody><tr>
<td align="left">cat 文件名</td>
<td align="left">查看文件所有内容</td>
</tr>
<tr>
<td align="left">more 文件名</td>
<td align="left">查看文件所有的内容,可以分屏显示</td>
</tr>
<tr>
<td align="left">head 文件名</td>
<td align="left">查看文件前10行</td>
</tr>
<tr>
<td align="left">had -n 行数 文件名</td>
<td align="left">查看前面指定的行数</td>
</tr>
<tr>
<td align="left">tail 文件名</td>
<td align="left">查看文件后10行</td>
</tr>
<tr>
<td align="left">tail -n 行数 文件名</td>
<td align="left">查看文件后指定的行数</td>
</tr>
<tr>
<td align="left">less 文件名</td>
<td align="left">查看文件所有内容 -n 显示行号 PageUp 向前翻页 PageDown 向后翻页 q 退出</td>
</tr>
</tbody></table>
<h2 id="编辑文件内容"><a href="#编辑文件内容" class="headerlink" title="编辑文件内容"></a>编辑文件内容</h2><p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914170903399.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914170903399.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914170903399"></p>
<ul>
<li>命令模式下命令</li>
</ul>
<table>
<thead>
<tr>
<th align="left">命令</th>
<th align="left">描述</th>
</tr>
</thead>
<tbody><tr>
<td align="left">i</td>
<td align="left">在当前光标的前面插入字符</td>
</tr>
<tr>
<td align="left">a</td>
<td align="left">在当前光标的后面插入字符</td>
</tr>
<tr>
<td align="left">o</td>
<td align="left">在当前光标的下一行插入字符</td>
</tr>
<tr>
<td align="left"><strong>命令或底行模式下常用的编辑命令</strong></td>
<td align="left"></td>
</tr>
<tr>
<td align="left">yy</td>
<td align="left">复制当前行</td>
</tr>
<tr>
<td align="left">p</td>
<td align="left">如果前面已经复制了,在当前下面复制</td>
</tr>
<tr>
<td align="left">dd</td>
<td align="left">删除当前行</td>
</tr>
<tr>
<td align="left">u</td>
<td align="left">撤销</td>
</tr>
<tr>
<td align="left">/字符串</td>
<td align="left">搜索文本内容 n:向后搜索 N:向前搜索</td>
</tr>
<tr>
<td align="left">wp</td>
<td align="left">保存并退出</td>
</tr>
<tr>
<td align="left">q!</td>
<td align="left">不保存强制退出</td>
</tr>
<tr>
<td align="left">wp!</td>
<td align="left">强制保存退出(只读文件使用)</td>
</tr>
</tbody></table>
<h2 id="压缩与解压"><a href="#压缩与解压" class="headerlink" title="压缩与解压"></a>压缩与解压</h2><table>
<thead>
<tr>
<th align="left">拓展名称</th>
<th align="left">分类</th>
</tr>
</thead>
<tbody><tr>
<td align="left">.zip/.rar</td>
<td align="left">Windows系统压缩包</td>
</tr>
<tr>
<td align="left">.tar</td>
<td align="left">在Linux下的打包文件</td>
</tr>
<tr>
<td align="left">.gz</td>
<td align="left">在Linux下的压缩文件</td>
</tr>
<tr>
<td align="left">.tar.gz</td>
<td align="left">在Linux下的打包压缩文件</td>
</tr>
</tbody></table>
<ul>
<li>压缩文件</li>
</ul>
<table>
<thead>
<tr>
<th align="left">tar</th>
<th align="left">参数 压缩包名 一个或多个文件{对一个或多个文件进行打包并压缩}</th>
</tr>
</thead>
<tbody><tr>
<td align="left">-c</td>
<td align="left">创建一个打包的文件</td>
</tr>
<tr>
<td align="left">-v</td>
<td align="left">显示打包的详细过程</td>
</tr>
<tr>
<td align="left">-z</td>
<td align="left">压缩文件</td>
</tr>
<tr>
<td align="left">-f&lt;压缩文件名称&gt;</td>
<td align="left">只当压缩包的文件名称,f后面跟着压缩的文件名,一般放在参数最后面</td>
</tr>
</tbody></table>
<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914171652900.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914171652900.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914171652900"></p>
<ul>
<li>解压文件</li>
</ul>
<table>
<thead>
<tr>
<th align="left">tar 参数 压缩文件名称</th>
<th align="left">解压文件到当前目录</th>
</tr>
</thead>
<tbody><tr>
<td align="left">-x</td>
<td align="left">解压指定的文件</td>
</tr>
<tr>
<td align="left">-v</td>
<td align="left">显示解压的详细过程</td>
</tr>
<tr>
<td align="left">-f&lt;压缩文件&gt;</td>
<td align="left">指定要解压的文件</td>
</tr>
<tr>
<td align="left">-C</td>
<td align="left">解压到指定的目录下</td>
</tr>
</tbody></table>
<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914172015604.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914172015604.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif"></p>
<h2 id="查看工作目录位置—查看进程—内存耗用—杀死进程"><a href="#查看工作目录位置—查看进程—内存耗用—杀死进程" class="headerlink" title="查看工作目录位置—查看进程—内存耗用—杀死进程"></a>查看工作目录位置—查看进程—内存耗用—杀死进程</h2><ul>
<li>查看进程</li>
</ul>
<table>
<thead>
<tr>
<th align="left">pwd</th>
<th align="left">查看当前工作目录</th>
</tr>
</thead>
<tbody><tr>
<td align="left">ps</td>
<td align="left">显示当前用户通过终端启动的进程</td>
</tr>
<tr>
<td align="left">-a</td>
<td align="left">显示所有用户通过终端启动的进程</td>
</tr>
<tr>
<td align="left">-u</td>
<td align="left">显示所有用户通过终端启动的进程详细信息</td>
</tr>
<tr>
<td align="left">-x</td>
<td align="left">显示所有用户的所有进程</td>
</tr>
</tbody></table>
<ul>
<li>杀死进程</li>
</ul>
<table>
<thead>
<tr>
<th align="left">kill 参数 进程号</th>
<th align="left">通过ps可以查看到进程号</th>
</tr>
</thead>
<tbody><tr>
<td align="left">-9</td>
<td align="left">强制终止进程（）这是数字9不是g</td>
</tr>
</tbody></table>
<ul>
<li>查看系统内存整体耗用</li>
</ul>
<table>
<thead>
<tr>
<th align="left">top</th>
</tr>
</thead>
<tbody><tr>
<td align="left">查看系统内存整体耗用</td>
</tr>
</tbody></table>
<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914173725139.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914173725139.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914173725139"></p>
<h1 id="搜索文件内容"><a href="#搜索文件内容" class="headerlink" title="搜索文件内容"></a>搜索文件内容</h1><blockquote>
<p>grep是一种强大的文本搜索工具，它能使用字符串搜索文本，并把匹配的行和行号打印出来。</p>
</blockquote>
<ul>
<li>搜索</li>
</ul>
<table>
<thead>
<tr>
<th align="left">grep 参数 字符串 文件名</th>
<th align="left">搜索指定文件中字符串内容</th>
</tr>
</thead>
<tbody><tr>
<td align="left">-n</td>
<td align="left">搜索结果中显示行号</td>
</tr>
<tr>
<td align="left">-v</td>
<td align="left">显示不匹配的行</td>
</tr>
<tr>
<td align="left">-i</td>
<td align="left">忽略大小写搜索</td>
</tr>
</tbody></table>
<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914174055316.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914174055316.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914174055316"></p>
<h1 id="管道"><a href="#管道" class="headerlink" title="管道"></a>管道</h1><blockquote>
<p>管道就是“|”</p>
</blockquote>
<ul>
<li>命令</li>
</ul>
<table>
<thead>
<tr>
<th align="left">语法</th>
<th align="left">命令1 | 命令2</th>
</tr>
</thead>
<tbody><tr>
<td align="left">解释</td>
<td align="left">管道命令|,必须要有两条以上的命令参与运算</td>
</tr>
</tbody></table>
<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914174402412.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914174402412.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914174402412"></p>
<h1 id="关机与重启"><a href="#关机与重启" class="headerlink" title="关机与重启"></a>关机与重启</h1><ul>
<li>Linux/Windows</li>
</ul>
<table>
<thead>
<tr>
<th align="left">Linux</th>
<th align="left">释义</th>
</tr>
</thead>
<tbody><tr>
<td align="left">shutdown now</td>
<td align="left">关闭服务器</td>
</tr>
<tr>
<td align="left">-h +参数</td>
<td align="left">指定**时间后关机</td>
</tr>
<tr>
<td align="left">shutdown -n 16:05</td>
<td align="left">指定时间关机</td>
</tr>
<tr>
<td align="left">shutdown -c</td>
<td align="left">清除定时命令</td>
</tr>
<tr>
<td align="left">reboot</td>
<td align="left">重启Linux</td>
</tr>
<tr>
<td align="left"><strong>Windows命令</strong></td>
<td align="left"><strong>释义</strong></td>
</tr>
<tr>
<td align="left">shutdown -s</td>
<td align="left">立刻关机</td>
</tr>
<tr>
<td align="left">shutdown -s -t 秒</td>
<td align="left">指定多少秒后关机</td>
</tr>
<tr>
<td align="left">shutdown -a</td>
<td align="left">清除定时计划</td>
</tr>
<tr>
<td align="left">shutdown -r</td>
<td align="left">系统重启</td>
</tr>
</tbody></table>
<h1 id="文件权限"><a href="#文件权限" class="headerlink" title="文件权限"></a>文件权限</h1><p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914174622447.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914174622447.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914174622447"></p>
<ul>
<li>每一类用户都有3个权限<ul>
<li>r：读取权限， 只读</li>
<li>w: 写入权限 ， 可以编辑文件</li>
<li>x: 执行权限， 由于某些文件是可以执行的，如有有执行权限才可以执行</li>
</ul>
</li>
<li>操作权限<ul>
<li>添加权限：chmod 用户或组+权限 资源文件或目录</li>
<li>删除权限：chmod 用户或组-权限 资源文件或目录</li>
<li>修改权限：chmod 用户或组=权限 资源文件或目录</li>
</ul>
</li>
</ul>
<h1 id="crontab定时任务"><a href="#crontab定时任务" class="headerlink" title="crontab定时任务"></a>crontab定时任务</h1><table>
<thead>
<tr>
<th align="left">命令</th>
<th align="left">含义</th>
</tr>
</thead>
<tbody><tr>
<td align="left">crontab -l</td>
<td align="left">查看当前用户的定时任务列表</td>
</tr>
<tr>
<td align="left">crontab -e</td>
<td align="left">进入编辑当前用户定时任务编辑器</td>
</tr>
<tr>
<td align="left">crontab -r</td>
<td align="left">删除当前用户的定时任务</td>
</tr>
<tr>
<td align="left">* * * * * 命令</td>
<td align="left">每分钟执行一次命令</td>
</tr>
</tbody></table>
<h1 id="服务管理—自启动服务管理"><a href="#服务管理—自启动服务管理" class="headerlink" title="服务管理—自启动服务管理"></a>服务管理—自启动服务管理</h1><p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914174840763.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914174840763.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914174840763"></p>
<ul>
<li>服务管理的命令：systemctl start/stop/restart/status 服务名 操作服务启动/停止/重启/查看状态</li>
<li>设置服务开机启动：systemctl enable 服务名.service</li>
<li>设置服务开机不启动：systemctl disable 服务名.service</li>
</ul>
<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914175128201.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914175128201.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914175128201"></p>
<h2 id="网络管理1-主机名管理"><a href="#网络管理1-主机名管理" class="headerlink" title="网络管理1-主机名管理"></a>网络管理1-主机名管理</h2><ul>
<li>主机名称命令</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 查看主机名</span></span><br><span class="line">$ hostname</span><br><span class="line"><span class="comment"># 修改主机名称 永久修改计算机名字，需要重启或使用bash刷新</span></span><br><span class="line">$ hostnamectl set-hostname [args]</span><br><span class="line"><span class="comment"># 刷新</span></span><br><span class="line">$ bash</span><br></pre></td></tr></table></figure>

<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914175257945.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914175257945.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914175257945"></p>
<h2 id="网络管理2-网络服务管理"><a href="#网络管理2-网络服务管理" class="headerlink" title="网络管理2-网络服务管理"></a>网络管理2-网络服务管理</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 启动网络</span></span><br><span class="line">$ systemctl start network</span><br><span class="line"><span class="comment"># 停止</span></span><br><span class="line">$ systemctl stop network</span><br><span class="line"><span class="comment"># 重启</span></span><br><span class="line">$ systemctl restart network</span><br><span class="line"><span class="comment"># 查看状态</span></span><br><span class="line">$ systemctl status network</span><br></pre></td></tr></table></figure>

<blockquote>
<p>如果linux系统不能上网（内网和外网），需要检查网络服务</p>
</blockquote>
<h2 id="网络管理3-网卡激活管理"><a href="#网络管理3-网卡激活管理" class="headerlink" title="网络管理3-网卡激活管理"></a>网络管理3-网卡激活管理</h2><ul>
<li>关闭网卡激活实现步骤</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 找到网卡配置文件ens32</span></span><br><span class="line">$ <span class="built_in">cd</span> /etc/sysconfig/network-scripts/ <span class="comment"># 网卡配置文件目录</span></span><br><span class="line"><span class="comment"># 查看目录文件</span></span><br><span class="line">$ ls</span><br><span class="line"><span class="comment"># 修改配置文件</span></span><br><span class="line">$ vim ifcfg-ens32</span><br><span class="line"><span class="comment"># 修改配置,关闭网卡</span></span><br><span class="line">ONBOOT=no</span><br><span class="line"><span class="comment"># 重启网络服务</span></span><br><span class="line">$ systemctl restart network</span><br><span class="line"><span class="comment"># 测试是否可以联网</span></span><br><span class="line">$ ping www.mobaijun.com</span><br><span class="line"><span class="comment"># 修改配置/激活网卡 修片配置文件ifcfg-ens33,开启网卡</span></span><br><span class="line">$ ONBOOT=yes</span><br><span class="line"><span class="comment"># 重启网络服务</span></span><br><span class="line">$ systemctl restart network</span><br></pre></td></tr></table></figure>

<h2 id="网络管理4-配置静态ip"><a href="#网络管理4-配置静态ip" class="headerlink" title="网络管理4-配置静态ip"></a>网络管理4-配置静态ip</h2><ul>
<li>IP配置类型<ul>
<li><strong>dhcp:动态IP</strong></li>
<li><strong>static:静态IP</strong></li>
</ul>
</li>
<li>配置静态IP步骤<ul>
<li>给linux系统设置ip必须确定ip的地址、子网掩码、网关</li>
<li>IP地址(互联网协议地址):<ul>
<li>IP地址由网络号和主机号组成</li>
</ul>
</li>
<li>子网掩码<ul>
<li>用于标识ip地址的网络号是多少位</li>
</ul>
</li>
<li>网关<ul>
<li>用于区别不同的网络，网关可以解决不同的网络通信，需要硬件支持路由器</li>
</ul>
</li>
<li>DNS<ul>
<li>域名服务器，根据域名获取对应的服务器ip地址，这样才可以访问外网</li>
</ul>
</li>
</ul>
</li>
<li>修改网卡配置</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 找到网卡配置文件ens32</span></span><br><span class="line">$ <span class="built_in">cd</span> /etc/sysconfig/network-scripts/ <span class="comment"># 网卡配置文件目录</span></span><br><span class="line"><span class="comment"># 查看目录文件</span></span><br><span class="line">$ ls</span><br><span class="line"><span class="comment"># 修改配置文件</span></span><br><span class="line">$ vim ifcfg-ens32</span><br><span class="line"><span class="comment"># 修改配置,切换成静态模式</span></span><br><span class="line">BOOTPROTO=static</span><br><span class="line"><span class="comment"># 最下方添加相关内容</span></span><br><span class="line">IPADDR=192.168.56.135</span><br><span class="line">GATEWAY=192.168.123.83</span><br><span class="line">NETMASK=255.255.255.0</span><br><span class="line">DNS1=114.114.114.114</span><br><span class="line"><span class="comment"># 重启网络服务</span></span><br><span class="line">$ systemctl restart network</span><br><span class="line"><span class="comment"># 测试是否可以联网</span></span><br><span class="line">$ ping www.mobaijun.com</span><br></pre></td></tr></table></figure>

<h2 id="网络管理5-克隆虚拟电脑"><a href="#网络管理5-克隆虚拟电脑" class="headerlink" title="网络管理5-克隆虚拟电脑"></a>网络管理5-克隆虚拟电脑</h2><ul>
<li>克隆步骤<ul>
<li><strong>关闭当前虚拟机linux系统</strong></li>
<li><strong>选择当前虚拟机/管理/克隆/</strong></li>
<li><strong>修改克隆出来的静态ip</strong></li>
<li><strong>修改计算机的名字</strong></li>
</ul>
</li>
</ul>
<h2 id="网络管理6-域名映射"><a href="#网络管理6-域名映射" class="headerlink" title="网络管理6-域名映射"></a>网络管理6-域名映射</h2><ul>
<li><h5 id="url域名访问服务器通信原理"><a href="#url域名访问服务器通信原理" class="headerlink" title="url域名访问服务器通信原理"></a>url域名访问服务器通信原理</h5><p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914175338701.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914175338701.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914175338701"></p>
</li>
<li><p>本地域名映射文件位置</p>
</li>
<li><p>Windows系统本地域名映射位置:</p>
<ul>
<li><code>c:\windows\System32\drivers\etc\hosts</code></li>
</ul>
</li>
<li><p>Linux系统本地域名映射位置:</p>
<ul>
<li><code>/etc/hosts</code></li>
</ul>
</li>
<li><p>修改本地域名映射实现步骤</p>
</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 编辑本地etc/hosts域名映射文件</span></span><br><span class="line">$ vim /etc/hosts</span><br><span class="line"><span class="comment"># 添加域名映射IP的配置</span></span><br><span class="line">192.168.123.83 www.mobaijun.com</span><br><span class="line"><span class="comment"># 保存退出</span></span><br><span class="line">$ wq</span><br><span class="line"><span class="comment"># 测试效果</span></span><br><span class="line">$ ping www.mobaijun.com</span><br></pre></td></tr></table></figure>

<h2 id="网络管理7-查询网络进程使用端口号"><a href="#网络管理7-查询网络进程使用端口号" class="headerlink" title="网络管理7-查询网络进程使用端口号"></a>网络管理7-查询网络进程使用端口号</h2><p>常用命令</p>
<table>
<thead>
<tr>
<th align="left">netstat [args]</th>
<th align="left">null</th>
<th align="left">显示网络状态</th>
</tr>
</thead>
<tbody><tr>
<td align="left">-n</td>
<td align="left">number</td>
<td align="left">显示程序的IP地址和端口号</td>
</tr>
<tr>
<td align="left">-t</td>
<td align="left">TCP</td>
<td align="left">只显示TCP协议链接的程序</td>
</tr>
<tr>
<td align="left">-l</td>
<td align="left">listener</td>
<td align="left">显示监听中的Socket</td>
</tr>
<tr>
<td align="left">-p</td>
<td align="left">Programs</td>
<td align="left">显示程序的名称</td>
</tr>
<tr>
<td align="left">-u</td>
<td align="left">UDP</td>
<td align="left">查询udp协议通信的程序</td>
</tr>
</tbody></table>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 查看端口、udp、tcp、正在监听、显示程序名的所有程序</span></span><br><span class="line">$ netstat -nutlp</span><br></pre></td></tr></table></figure>

<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914175856864.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914175856864.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914175856864"></p>
<h2 id="防火墙管理"><a href="#防火墙管理" class="headerlink" title="防火墙管理"></a>防火墙管理</h2><blockquote>
<ul>
<li>防火墙作用</li>
</ul>
<p>是防止外界访问系统内部的程序，防火墙允许哪个软件访问外网，这个软件才可以进行网络通信</p>
</blockquote>
<table>
<thead>
<tr>
<th align="left">命令</th>
<th align="left">简介</th>
</tr>
</thead>
<tbody><tr>
<td align="left">systemctl status firewalld</td>
<td align="left">查看状态</td>
</tr>
<tr>
<td align="left">systemctl start firewalld</td>
<td align="left">启动防火墙</td>
</tr>
<tr>
<td align="left">systemctl stop firewalld</td>
<td align="left">关闭防火墙</td>
</tr>
<tr>
<td align="left">systemctl enable firewalld</td>
<td align="left">开机自启</td>
</tr>
<tr>
<td align="left">systemctl disable firewalld</td>
<td align="left">让防火墙开机不自启</td>
</tr>
</tbody></table>
<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914175952527.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914175952527.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914175952527"></p>
<h2 id="SSH有密登录和免密登录"><a href="#SSH有密登录和免密登录" class="headerlink" title="SSH有密登录和免密登录"></a>SSH有密登录和免密登录</h2><ul>
<li><strong>SSH实现免密登录步骤</strong></li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 在本地生成一对公钥和私钥</span></span><br><span class="line">$ ssh-keygen</span><br><span class="line"><span class="comment"># 将公钥发送给远程服务器,必须给出远程服务器的密码本地才接收公钥</span></span><br><span class="line">$ ssh-copy-id address</span><br><span class="line"><span class="comment"># 查看公钥</span></span><br><span class="line">$ cat authorized_keys</span><br><span class="line"><span class="comment"># 发送登录请求，实现免密登录</span></span><br><span class="line">$ ssh address	//address是服务器地址或者仓库地址</span><br></pre></td></tr></table></figure>

<h1 id="部署项目"><a href="#部署项目" class="headerlink" title="部署项目"></a>部署项目</h1><h2 id="本地软件安装命令rpm"><a href="#本地软件安装命令rpm" class="headerlink" title="本地软件安装命令rpm"></a>本地软件安装命令rpm</h2><blockquote>
<p>RedHat Package Manager(RPM)， 擅长安装本地的软件</p>
<ul>
<li>rpm的作用<ul>
<li>查询已安装的软件</li>
<li>安装软件</li>
<li>卸载软件</li>
</ul>
</li>
</ul>
</blockquote>
<ul>
<li>常用命令</li>
</ul>
<table>
<thead>
<tr>
<th align="left">rpm [args] [包名]</th>
<th align="left">类似软件管家{添加,卸载,查询}</th>
</tr>
</thead>
<tbody><tr>
<td align="left">-v</td>
<td align="left">显示安装的详细过程</td>
</tr>
<tr>
<td align="left">-q</td>
<td align="left">查询某个软件是否安装</td>
</tr>
<tr>
<td align="left">-a</td>
<td align="left">查询所有软件</td>
</tr>
<tr>
<td align="left">-h</td>
<td align="left">列出软件安装时的标记</td>
</tr>
<tr>
<td align="left">-i</td>
<td align="left">install 安装指定的软件</td>
</tr>
<tr>
<td align="left">–nodeps</td>
<td align="left">不验证软件相关关联性,常于-e一起使用,表示强制卸载</td>
</tr>
</tbody></table>
<ul>
<li>测试</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 查询所有已安装软件</span></span><br><span class="line">$ rpm -qa</span><br><span class="line"><span class="comment"># 安装指定的软件包</span></span><br><span class="line">$ rpm -ivh &lt;包名&gt;</span><br><span class="line"><span class="comment"># 强制卸载指定软件包</span></span><br><span class="line">$ rpm -e --nodeps &lt;包名&gt;</span><br></pre></td></tr></table></figure>

<h2 id="RPM-jdk安装"><a href="#RPM-jdk安装" class="headerlink" title="RPM_jdk安装"></a>RPM_jdk安装</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 查询本地是否有JDK</span></span><br><span class="line">$ rpm -qa | grep java</span><br><span class="line"><span class="comment"># 查询是否安装JDK</span></span><br><span class="line">$ rpm -qR jdk</span><br><span class="line"><span class="comment"># 新建soft包存放未解压的安装包</span></span><br><span class="line">$ mkdir soft</span><br><span class="line"><span class="comment"># 将jdk软件上传到linux系统/soft目录下并解压到指定目录</span></span><br><span class="line">$ tar -xvf jdk-8u251-linux-x64.tar.gz -C /usr/<span class="built_in">local</span></span><br><span class="line"><span class="comment"># 配置linux的jdk环境变量，操作一个/etc/profile环境变量配置文件</span></span><br><span class="line">$ vim /etc/profile</span><br><span class="line"><span class="comment"># 配置环境变量</span></span><br><span class="line"><span class="comment">#set java environment</span></span><br><span class="line">JAVA_HOME=/usr/<span class="built_in">local</span>/jdk1.8.0_251</span><br><span class="line">CLASSPATH=.:<span class="variable">$JAVA_HOME</span>/lib</span><br><span class="line">PATH=<span class="variable">$JAVA_HOME</span>/bin:<span class="variable">$PATH</span></span><br><span class="line"><span class="built_in">export</span> JAVA_HOME CLASSPATH PATH</span><br><span class="line"><span class="comment"># 重载环境变量配置文件</span></span><br><span class="line">$ <span class="built_in">source</span> /etc/profile</span><br><span class="line"><span class="comment"># 查看jdk环境变量是否配置成功</span></span><br><span class="line">$ java -version</span><br></pre></td></tr></table></figure>

<h2 id="更换YUM源"><a href="#更换YUM源" class="headerlink" title="更换YUM源"></a>更换YUM源</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 安装wget</span></span><br><span class="line">$ yum install -y wget</span><br><span class="line"><span class="comment"># 下载CentOS 7的repo文件</span></span><br><span class="line">$ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo</span><br><span class="line"><span class="comment"># 清除缓存</span></span><br><span class="line">$ yum clean all</span><br><span class="line"><span class="comment"># 生成缓存</span></span><br><span class="line">$ yum makecache</span><br><span class="line"><span class="comment"># 备份CentOS 7系统自带yum源配置文件</span></span><br><span class="line">$ mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup</span><br><span class="line"><span class="comment"># 打开CentOS-Base.repo文件,将文件中的所有http开头的地址更改为https</span></span><br><span class="line">$ vim /etc/yum.repos.d/CentOS-Base.repo</span><br><span class="line"><span class="comment"># 更新YUM</span></span><br><span class="line">$ yum update</span><br></pre></td></tr></table></figure>

<h2 id="mysql安装-启动-远程授权"><a href="#mysql安装-启动-远程授权" class="headerlink" title="mysql安装-启动-远程授权"></a>mysql安装-启动-远程授权</h2><ul>
<li>MySQL安装</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 查看CentOS是否自带的MySQL，如果已经安装需要卸载。如果没有找到，则表示没有安装</span></span><br><span class="line">$ rpm -qa | grep mysql</span><br><span class="line"><span class="comment"># 在线获取CentOS7的mysql的rpm安装文件，直接执行如下命令：</span></span><br><span class="line">$ wget https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm</span><br><span class="line"><span class="comment"># 执行安装命令</span></span><br><span class="line">$ rpm -ivh mysql80-community-release-el7-1.noarch.rpm</span><br><span class="line"><span class="comment"># 得到两个配置文件，进入/etc/yum.repos.d目录下查询</span></span><br><span class="line">$ <span class="built_in">cd</span> /etc/yum.repos.d </span><br><span class="line"><span class="comment"># 编辑mysql-community.repo文件，配置资源库下载版本选择</span></span><br><span class="line">$ vim mysql-community.repo</span><br><span class="line"><span class="comment"># 编辑需要下载的MySQL版本将`enable=0`改为`enable=1`</span></span><br><span class="line">&#123;</span><br><span class="line">[mysql55-community]</span><br><span class="line">name=MySQL 5.5 Community Server</span><br><span class="line">baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/7/<span class="variable">$basearch</span>/</span><br><span class="line">enabled=1</span><br><span class="line">gpgcheck=1</span><br><span class="line">gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment"># 下载安装客户端、服务器端、工具包</span></span><br><span class="line">$ yum -y install mysql-community-client mysql-community-server mysql-community-devel</span><br></pre></td></tr></table></figure>

<ul>
<li>启动</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 启动MySQL</span></span><br><span class="line">$ systemctl start mysqld</span><br><span class="line"><span class="comment"># 将mysql加到系统服务中并设置开机启动</span></span><br><span class="line">$ systemctl <span class="built_in">enable</span> mysqld</span><br><span class="line"><span class="comment"># 登录mysql，root用户默认没有密码</span></span><br><span class="line">$ mysql -uroot</span><br><span class="line"><span class="comment"># 在mysql中修改自己的密码</span></span><br><span class="line">$ <span class="built_in">set</span> password = password(<span class="string">&#x27;root&#x27;</span>);</span><br><span class="line"><span class="comment"># 退出</span></span><br><span class="line">$ <span class="built_in">exit</span></span><br><span class="line"><span class="comment"># 重新登录</span></span><br><span class="line">$ mysql -uroot -proot</span><br></pre></td></tr></table></figure>

<ul>
<li><p>设置远程连接权限、开放端口号</p>
<blockquote>
<p>开启mysql的远程登录权限，默认情况下mysql为安全起见，不支持远程登录mysql，所以需要设置开启，并且刷新权限缓存。远程登录mysql的权限登录mysql后输入如下命令</p>
</blockquote>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 开启mysql的远程登录权限</span></span><br><span class="line">$ grant all privileges on *.* to <span class="string">&#x27;root&#x27;</span>@<span class="string">&#x27;%&#x27;</span> identified by <span class="string">&#x27;root&#x27;</span>;</span><br><span class="line"><span class="comment"># 刷新权限缓存</span></span><br><span class="line">$ flush privileges;</span><br></pre></td></tr></table></figure></li>
<li><p>开放Linux的对外访问的端口3306</p>
</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 开放的端口永久保存到防火墙</span></span><br><span class="line">$ firewall-cmd --zone=public --add-port=3306/tcp --permanent</span><br><span class="line"><span class="comment"># 重启防火墙</span></span><br><span class="line">$ systemctl restart firewalld</span><br></pre></td></tr></table></figure>

<ul>
<li>Navicat测试</li>
</ul>
<h2 id="tomcat安装-启动"><a href="#tomcat安装-启动" class="headerlink" title="tomcat安装-启动"></a>tomcat安装-启动</h2><ul>
<li><a target="_blank" rel="noopener" href="https://tomcat.apache.org/download-80.cgi">下载Tomcat</a></li>
</ul>
<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914180538691.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914180538691.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914180538691"></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 将软件上传到linux系统/soft目录下并解压</span></span><br><span class="line">$ tar -xvf apache-tomcat-8.5.55-src.tar.gz  -C /usr/<span class="built_in">local</span>/</span><br><span class="line"><span class="comment"># 改名</span></span><br><span class="line">$ mv apache-tomcat-8.5.55-src tomcat8</span><br><span class="line"><span class="comment"># 进入bin目录</span></span><br><span class="line">$ <span class="built_in">cd</span> /usr/<span class="built_in">local</span>/apache-tomcat-8.5.55-src/bin</span><br><span class="line"><span class="comment"># 启动tomcat服务器</span></span><br><span class="line">$ ./startup.sh</span><br><span class="line"><span class="comment"># 提示权限不够解决方案</span></span><br><span class="line">$ chmod u+x *.sh</span><br><span class="line"><span class="comment"># 重启应用服务</span></span><br><span class="line">$ ./startup.sh</span><br><span class="line"><span class="comment"># 开放linux系统防火墙8080端口</span></span><br><span class="line">$ firewall-cmd --zone=public --add-port=8080/tcp --permanent</span><br><span class="line"><span class="comment"># 检查是否生效</span></span><br><span class="line">$ firewall-cmd --zone=public --query-port=8080/tcp</span><br><span class="line"><span class="comment"># 重启防火墙</span></span><br><span class="line">$ systemctl restart firewalld</span><br><span class="line"><span class="comment"># windows客户端使用浏览器访问linux的8080端口tomcat</span></span><br><span class="line">$ 192.168.123.83:8080</span><br><span class="line"><span class="comment"># tomcat无法找到JAVA_HOME解决方案</span></span><br><span class="line"><span class="comment"># 查看环境变量是否有问题</span></span><br><span class="line">$ <span class="built_in">echo</span> <span class="variable">$JAVA_HOME</span></span><br><span class="line">$ <span class="built_in">echo</span> <span class="variable">$JRE_HOME</span></span><br><span class="line"><span class="comment"># 定位到tomcat/bin/setclasspath.sh目录下,文件开头添加环境变量</span></span><br><span class="line">JAVA_HOME=/usr/<span class="built_in">local</span>/jdk1.8.0_251</span><br><span class="line">JRE_HOME=/usr/<span class="built_in">local</span>/jdk1.8.0_251/jre</span><br><span class="line"><span class="comment"># 删除tomcat和日志文件</span></span><br><span class="line">$ rm -rf /usr/<span class="built_in">local</span>/tomcat</span><br><span class="line">$ rm -rf /usr/<span class="built_in">local</span>/logs/*.txt &amp;</span><br><span class="line">$ rm -rf /usr/<span class="built_in">local</span>/logs/*.<span class="built_in">log</span> &amp;</span><br></pre></td></tr></table></figure>

<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914180604381.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914180604381.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914180604381"></p>
<h2 id="Redis安装-启动"><a href="#Redis安装-启动" class="headerlink" title="Redis安装-启动"></a>Redis安装-启动</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 添加EPEL Repository</span></span><br><span class="line">$ yum install epel-release</span><br><span class="line"><span class="comment"># 更新yum</span></span><br><span class="line">$ yum update</span><br><span class="line"><span class="comment"># 安装Redis</span></span><br><span class="line">$ yum install redis</span><br><span class="line"><span class="comment"># 启动Redis</span></span><br><span class="line">$ systemctl start redis</span><br><span class="line"><span class="comment"># 设置开启启动</span></span><br><span class="line">$ systemctl <span class="built_in">enable</span> redis</span><br><span class="line"><span class="comment"># 验证Redis是否安装成功 /如果返回PONG，说明Redis安装成功</span></span><br><span class="line">$ redis-cli ping</span><br><span class="line"><span class="comment"># 设置Redis密码/打开Redis配置文件/找到# requirepass foobared，取消注释，将foobared 改成你的密码</span></span><br><span class="line">$ vi /etc/redis.conf</span><br><span class="line"><span class="comment"># 全局查找,修改密码</span></span><br><span class="line">$ requirepass root</span><br><span class="line"><span class="comment"># 然后重启redis服务</span></span><br><span class="line">$ systemctl restart redis</span><br><span class="line"><span class="comment"># 使用AUTH验证登录</span></span><br><span class="line">$ redis-cli</span><br><span class="line">$ 127.0.0.1:6379&gt; AUTH root</span><br><span class="line"><span class="comment"># 开启Redis远程连接打开Redis配置文件，找到bind 127.0.0.1，取消注释，将127.0.0.1 修改为 0.0.0.0 或 服务器的ip地址。别忘了重启 redis 服务</span></span><br><span class="line">$ vi /etc/redis.conf</span><br><span class="line"><span class="comment"># 然后重启redis服务</span></span><br><span class="line">$ systemctl restart redis</span><br><span class="line"><span class="comment"># 配置防火墙开放6379端口</span></span><br><span class="line">$ firewall-cmd --permanent --zone=public --add-port=6379/tcp</span><br><span class="line">$ firewall-cmd --reload</span><br><span class="line"><span class="comment"># 检查是否生效</span></span><br><span class="line">$ iptables -L -n | grep 6379</span><br><span class="line"><span class="comment"># 远程连接</span></span><br><span class="line">$ redis-cli -h 192.168.116.128</span><br><span class="line">$ 192.168.56.2:6379&gt; AUTH root</span><br></pre></td></tr></table></figure>

<h2 id="Git安装-启动"><a href="#Git安装-启动" class="headerlink" title="Git安装-启动"></a>Git安装-启动</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 安装git</span></span><br><span class="line">$ yum install git</span><br><span class="line"><span class="comment"># 验证版本</span></span><br><span class="line">$ git --version</span><br><span class="line"><span class="comment"># 配置基本信息</span></span><br><span class="line">$ git config --global user.name <span class="string">&quot;mobaijun&quot;</span></span><br><span class="line">$ git config --global user.email <span class="string">&quot;mobaijun8@163.com&quot;</span></span><br><span class="line"><span class="comment"># 验证配置</span></span><br><span class="line">$ git config --list</span><br></pre></td></tr></table></figure>

<h2 id="项目发布"><a href="#项目发布" class="headerlink" title="项目发布"></a>项目发布</h2><ul>
<li>链接Linux数据库(导入数据库)</li>
<li>在IDEA中导出war包</li>
<li>将war包部署到linux里面的tomcat里面的webapps里面</li>
<li>浏览器访问</li>
</ul>
<h2 id="解决mysql底层乱码问题"><a href="#解决mysql底层乱码问题" class="headerlink" title="解决mysql底层乱码问题"></a>解决mysql底层乱码问题</h2><ul>
<li>修改<code>druid.properties</code>配置文件，设置mysql使用utf-8解码，添加<code>?characterEncoding=utf8</code></li>
</ul>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">driverClassName</span>=<span class="string">com.mysql.jdbc.Driver</span></span><br><span class="line"><span class="attr">url</span>=<span class="string">jdbc:mysql://127.0.0.1:3306/linux?characterEncoding=utf8</span></span><br><span class="line"><span class="attr">username</span>=<span class="string">root</span></span><br><span class="line"><span class="attr">password</span>=<span class="string">root</span></span><br><span class="line"><span class="attr">initialSize</span>=<span class="string">5</span></span><br><span class="line"><span class="attr">maxActive</span>=<span class="string">50</span></span><br><span class="line"><span class="attr">maxWait</span>=<span class="string">30000</span></span><br><span class="line"><span class="attr">minIdle</span>=<span class="string">3</span></span><br></pre></td></tr></table></figure>

<ul>
<li><strong>将当前项目需要重新打包，再部署到linux上tomcat的webapps里面</strong></li>
<li><strong>关闭tomcat,执行shutdown.sh</strong></li>
<li><strong>启动tomcat,执行startup.sh</strong></li>
</ul>
<h1 id="用户管理"><a href="#用户管理" class="headerlink" title="用户管理"></a>用户管理</h1><h2 id="用户的管理"><a href="#用户的管理" class="headerlink" title="用户的管理"></a>用户的管理</h2><ul>
<li>添加用户</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 添加用户,进入/home文件夹/创建用户和主目录</span></span><br><span class="line">$ <span class="built_in">cd</span> /home</span><br><span class="line"><span class="comment"># 查看</span></span><br><span class="line">$ ll</span><br><span class="line"><span class="comment"># 创建组名</span></span><br><span class="line">$ useradd -m mobaijun</span><br><span class="line"><span class="comment"># 查看</span></span><br><span class="line">$ ll</span><br><span class="line"><span class="comment"># 创建用户名</span></span><br><span class="line">$ useradd -mg mobaijun tom</span><br><span class="line"><span class="comment"># 查看</span></span><br><span class="line">[root@mobai home]<span class="comment"># ll</span></span><br><span class="line">总用量 0</span><br><span class="line">drwx------. 2 mobaijun mobaijun 62 5月  29 11:25 mobaijun</span><br><span class="line">drwx------. 2 tom      mobaijun 62 5月  29 11:25 tom</span><br><span class="line"><span class="comment"># 查看/etc/passwd用户内容</span></span><br><span class="line">$ cat /etc/passwd</span><br><span class="line"><span class="comment"># passwd文件用户内容</span></span><br><span class="line">mobaijun:x:1000:1000::/home/mobaijun:/bin/bash</span><br><span class="line">tom:x:1001:1000::/home/tom:/bin/bash</span><br></pre></td></tr></table></figure>

<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914180711482.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914180711482.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914180711482"></p>
<ul>
<li>给用户设置密码并切换用户</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 设置密码</span></span><br><span class="line">$ passwd mobaijun</span><br><span class="line"><span class="comment"># 切换用户</span></span><br><span class="line">$ su mobaijun</span><br></pre></td></tr></table></figure>

<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914180728373.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914180728373.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914180728373"></p>
<ul>
<li>删除用户</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 切换回主目录</span></span><br><span class="line">$ su root </span><br><span class="line"><span class="comment"># 删除用户组</span></span><br><span class="line">$ userdel -r tom</span><br></pre></td></tr></table></figure>

<p><img src="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914180741710.png" class="lazyload placeholder" data-srcset="https://gitee.com/yangyang-linux/yangyang-linux-io/raw/master/img/image-20210914180741710.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="image-20210914180741710"></p>
<ul>
<li>修改登录名</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 修改登录名称</span></span><br><span class="line">$ usermod -1 Rose mobaijun</span><br></pre></td></tr></table></figure>

<p><strong>总结</strong></p>
<ul>
<li><strong>useradd:添加用户</strong></li>
<li><strong>passwd:给用户设置密码</strong></li>
<li><strong>su:切换用户</strong></li>
<li><strong>userdel:删除用户</strong></li>
<li><strong>usermod:修改用户登录名</strong></li>
</ul>
<h2 id="组与用户的管理"><a href="#组与用户的管理" class="headerlink" title="组与用户的管理"></a>组与用户的管理</h2><ul>
<li>添加组</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 添加组</span></span><br><span class="line">$ groupadd [组名]</span><br><span class="line"><span class="comment"># 查看组</span></span><br><span class="line">$ cat /etc/group</span><br></pre></td></tr></table></figure>

<ul>
<li>用户添加指定组</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 进入主目录</span></span><br><span class="line">$ <span class="built_in">cd</span> /home</span><br><span class="line"><span class="comment"># 修改用户组名称</span></span><br><span class="line">$ usermod -g [新组名] [组名]</span><br></pre></td></tr></table></figure>

<ul>
<li>用户从指定组中删除</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 用户从指定组中删除</span></span><br><span class="line">$ gpasswd -d 用户 组名</span><br><span class="line"><span class="comment"># 查看</span></span><br><span class="line">$ ll</span><br><span class="line"><span class="comment"># 查看配置文件</span></span><br><span class="line">$ cat /etc/group</span><br></pre></td></tr></table></figure>

<ul>
<li>修改组名</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 修改组名</span></span><br><span class="line">$ groupmod -n 新组名 组名</span><br></pre></td></tr></table></figure>

<ul>
<li>删除组</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 删除组</span></span><br><span class="line">$ groupdel 组名</span><br><span class="line"><span class="comment"># 查看</span></span><br><span class="line">$ cat /etc/group</span><br></pre></td></tr></table></figure>

<p><strong>总结</strong></p>
<ul>
<li><strong>groupadd:添加组</strong></li>
<li><strong>gpaddwd:将用户从组中删除</strong></li>
<li><strong>groupmod:修改组名</strong></li>
<li><strong>groupdel:删除组</strong></li>
</ul>
<h2 id="给普通用户-设置-sudo超级管理权限"><a href="#给普通用户-设置-sudo超级管理权限" class="headerlink" title="给普通用户@设置 sudo超级管理权限"></a>给普通用户@设置 sudo超级管理权限</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 编辑配置文件</span></span><br><span class="line">$ vim /etc/sudoers</span><br><span class="line"><span class="comment"># 切换用户</span></span><br><span class="line">$ su mobaijun</span><br><span class="line"><span class="comment"># 设置权限</span></span><br><span class="line">$ sudo useradd -m 用户名</span><br><span class="line"><span class="comment"># 查看</span></span><br><span class="line">$ <span class="built_in">cd</span> /home</span><br></pre></td></tr></table></figure>

<h1 id="其他"><a href="#其他" class="headerlink" title="其他"></a>其他</h1><p><a target="_blank" rel="noopener" href="https://my.oschina.net/u/3803405/blog/1791255">相关内容</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 列出所有可更新的软件包  </span></span><br><span class="line">$ yum list updates </span><br><span class="line"><span class="comment"># 列出所有已安装的软件包 </span></span><br><span class="line">$ yum list installed </span><br><span class="line"><span class="comment"># 列出所有已安装但不在 Yum Repository 内的软件包 </span></span><br><span class="line">$ yum list extras </span><br><span class="line"><span class="comment"># 搜索yum包</span></span><br><span class="line">$ yum search PACKAGE_NAME</span><br><span class="line"><span class="comment"># 列出所有可更新的软件包信息 </span></span><br><span class="line">$ yum info updates </span><br><span class="line"><span class="comment"># 列出所有已安装的软件包信息 </span></span><br><span class="line">$ yum info installed </span><br><span class="line"><span class="comment"># .列出软件包提供哪些文件 </span></span><br><span class="line">$ yum provides</span><br><span class="line"><span class="comment"># 更新具体的yum包</span></span><br><span class="line">$ yum update PACKAGE_NAME</span><br><span class="line"><span class="comment"># 清除yum缓存</span></span><br><span class="line">$ yum clean all</span><br><span class="line"><span class="comment"># 卸载yum包装</span></span><br><span class="line">$ yum remove PACKAGE_NAME</span><br><span class="line"><span class="comment"># 取出yum包装</span></span><br><span class="line">$ yum downloader PACKAGE_NAME</span><br><span class="line"><span class="comment"># 重新安装一个yum包</span></span><br><span class="line">$ yum reinstall PACKAGE_NAME</span><br><span class="line"><span class="comment"># 查可以更新的软件包</span></span><br><span class="line">$ yum check-update </span><br></pre></td></tr></table></figure>


      </div>
      <div class="post-tags-categories">
        
        <div class="tags">
          
            <a href="/tags/%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/" class="">
              学习笔记
            </a>
          
        </div>
        
      </div>
      
        <div class="copyright">
  <ul class="post-copyright">
    <li class="post-copyright-author">
    <strong>作者:  </strong>阳阳</a>
    </li>
    <li class="post-copyright-link">
    <strong>文章链接:  </strong>
    <a href="/2021/09/14/linux-xue-xi-bi-ji/" target="_blank" title="Linux学习笔记">https://yangyang-linux.gitee.io/2021/09/14/linux-xue-xi-bi-ji/</a>
    </li>
    <li class="post-copyright-license">
      <strong>版权声明:   </strong>
      本网站所有文章除特别声明外,均采用 <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">CC BY-NC-ND 4.0</a>
      许可协议。转载请注明出处!
    </li>
  </ul>
<div>
      
    </article>
    <!-- 上一篇文章和下一篇文章 -->
    
      <!-- 文章详情页的上一页和下一页 -->
<div class="post-nav">



  
  <div class="post-nav-prev post-nav-item">
    <div class="post-nav-img" style="background-size: cover; 
      background-position: center center;">
      <img class="lazyload lazyload placeholder" src="/medias/1.jpg" class="lazyload placeholder" data-srcset="/medias/1.jpg" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="">
    </div>
    <a href="/2021/10/04/2021-10-04-final-ben-ji-lian-jie-centos-shu-ju-ku/" class="post-nav-link">
      <div class="title">
        <i class="fas fa-angle-left"></i> 上一篇:
        <div class="title-text">连接centos数据库（mysql）</div>
      </div>
      
      <!-- <div class="content">
        数据库下载安装1、下载mysql官方的Yum Repository可以下载到本地再用xftp上传到linux服务器，也可
      </div> -->
    </a>
  </div>



  
  <div class="post-nav-next post-nav-item">
    <div class="post-nav-img" style="background-size: cover; 
      background-position: center center;">
      <img class="lazyload lazyload placeholder" src="/medias/9.jpg" class="lazyload placeholder" data-srcset="/medias/9.jpg" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" src="" alt="">
    </div>
    <a href="/2021/09/02/zi-xue-lu-xian/" class="post-nav-link">
      <div class="title">
        下一篇: <i class="fas fa-angle-right"></i>
        <div class="title-text">自学路线</div>
      </div>
      <!-- <div class="content">
        今天的主题是——Web安全。
Web安全是网络渗透中很重要的一个组成部分，今天跟大家聊一下，如何在三个月内从零基础掌握W
      </div> -->
    </a>
  </div>

</div>

    
    

    <!-- 打赏 -->
    
      <div id="appDonate" class="post-donate">
  <div id="donate_board" class="donate_bar center" ref="donate">
    <a id="btn_donate" class="btn_donate" href="javascript:;" title="打赏" @click="showDialogDrawer()"></a>
  </div>
  <transition name="fade">
    <div 
      class="donate-box-mask"
      v-cloak 
      v-show="visible"
      @click="cancelDialogDrawer()"
    >
    </div>
  </transition>
  <transition name="bounce">
    <div class="donate-box" v-cloak v-show="visible">
      <div class="donate-box_close">
        <i class="fas fa-times" aria-hidden="true" @click="cancelDialogDrawer" pointer></i>
      </div>
      <div class="donate-box_title">
        <h4>
          你的赏识是我前进的动力
        </h4>
      </div>
      <div class="donate-box_tab">
        <div class="Alipay" pointer :class="{'active': tabActive === 'Alipay'}" @click="changeTabActive('Alipay')">
          支付宝
        </div>
        <div class="WeChatpay" pointer :class="{'active': tabActive === 'WeChatpay'}" @click="changeTabActive('WeChatpay')">
          微信
        </div>
      </div>
      <div class="donate-box_img">
        <div class="AlipayImg" v-show="tabActive === 'Alipay'">
          <img src="/medias/zfb.jpg" class="lazyload placeholder" data-srcset="/medias/zfb.jpg" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="支付宝打赏" />
        </div> 
        <div class="WeChatpayImg" v-show="tabActive === 'WeChatpay'">
          <img src="/medias/wx.jpg" class="lazyload placeholder" data-srcset="/medias/wx.jpg" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="微信打赏" />
        </div>
      </div>
    </div>
  </transition>
</div>

<script>
  var body = document.body || document.documentElement || window;
  var vm = new Vue({
    el: '#appDonate',
    data: {
      visible: false,
      tabActive: 'Alipay',
      top: 0,
    },
    computed: {
    },
    mounted() {
    },
    methods: {
      showDialogDrawer() {
        this.visible = true;
        // 防止页面滚动，只能让弹框滚动
        // function getScroll() {
        //   return {
        //     left: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0,
        //     top: window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0
        //   };
        // }
        this.top = $(document).scrollTop() // or getScroll().top
        // console.log('aa', $('.main-content'));
        body.style.cssText = 'overflow: hidden;';
      },
      cancelDialogDrawer() {
        this.visible = false;
        body.removeAttribute('style');
        $(document).scrollTop(this.top)
      },
      changeTabActive(name) {
        this.tabActive = name;
      }
    },
    created() {}
  })
</script>
    

    <!-- 分享 -->
    
      <!-- https://github.com/overtrue/share.js -->
<!-- 文章详情页的分享 -->
<div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>

<script src="/js/shareJs/social-share.min.js"></script>
</script>

<style>
  .social-share {
    margin: 20px 0;
  }
</style>


    
    
    <!-- 评论 -->
    <!-- 评论 -->

  <div id="myComment">
    
      
<section id="comments" style="padding: 1em; margin: 15px auto;"
	class="animated bounceInUp">
	<div id="vcomment" class="comment"></div>
</section>
<style>
	#comments {
		background: rgba(255,255,255,0.9);
	}
	#veditor {
		background-image: url('https://img.zcool.cn/community/01a253594c71cfa8012193a329a77f.gif');
		background-size: contain;
		background-repeat: no-repeat;
		background-position: right;
		background-color: rgba(255, 255, 255, 0);
		resize: vertical;
	}
	#veditor:focus{
		background-position-y: 200px;
		transition: all 0.2s ease-in-out 0s;
	}
	#vcomment .vcards .vcard .vh .vhead .vtag.vvisitor {
		background-color: #42b983;
	}
	.v[data-class=v] .vbtn:active, .v[data-class=v] .vbtn:hover {
		color: #42b983;
		border-color: #42b983;
	}
	#vcomment .vcards .vcard .vhead .vsys i {
		display: none;
	}
	/* 底部valine链接 */
	#vcomment .vpower {
		display: none;
	}
	
	/* 底下注释是修改 名称和邮箱和网址输入框的样式 */
	/* #vcomment .vheader {
		display: flex;
		justify-content: space-around;
	}
	
	#vcomment .vheader .vnick {
		width: 31%;
		border: 2px solid #dedede;
		padding-left: 10px;
		padding-right: 10px;
		border-radius: 5px
	}

	#vcomment .vheader .vmail {
		width: 31%;
		border: 2px solid #dedede;
		padding-left: 10px;
		padding-right: 10px;
		border-radius: 5px
	}

	#vcomment .vheader .vlink {
		width: 31%;
		border: 2px solid #dedede;
		padding-left: 10px;
		padding-right: 10px;
		border-radius: 5px
	} */

	img.vimg {
		transition: all 1s;
		/* 头像旋转时间为 1s */
	}

	img.vimg:hover {
		transform: rotate(360deg);
		-webkit-transform: rotate(360deg);
		-moz-transform: rotate(360deg);
		-o-transform: rotate(360deg);
		-ms-transform: rotate(360deg);
	}

	#vcomment .vcards .vcard {
		padding: 15px 20px 0 20px;
		border-radius: 10px;
		margin-bottom: 15px;
		box-shadow: 0 0 4px 1px rgba(0, 0, 0, .12);
		transition: all .3s
	}

	#vcomment .vcards .vcard:hover {
		box-shadow: 0 0 8px 3px rgba(0, 0, 0, .12)
	}

	#vcomment .vcards .vcard .vh .vcard {
		border: none;
		box-shadow: none;
	}
</style>
    
  </div>

<!-- comment script in themes\hexo-theme-bamboo\layout\_partial\scripts\index.ejs -->


  </div>

  <!-- 目录 -->
  <!-- 文章详情页右侧目录 -->

  <div class="toc-aside">
    <div class="toc-main">
      <div class="toc-aside-title">
        <i class="fas fa-list-ul" aria-hidden="true"></i><span>本文目录</span>
        
          <div class="toc-open-close">本文目录</div>
        
      </div>
      <div class="toc-content">
        <div class="toc"></div>
      </div>
    </div>
  </div>

  <!-- 手机端目录按钮 -->
  <div id="toc-mobile-btn">
    <i class="fas fa-list-ul" aria-hidden="true"></i>
  </div>


<script>
  function closeToc(init) {
    $(".toc-aside").css({'width': 0, 'padding': 0, 'transition': init ?  'noe' : 'width 0.3s' });
    $(".toc-content").css({'width': 0});
    $(".toc-aside-title span, .toc-aside-title i").css({'display': 'none'});
    $(".main-content").css({'width': '75%', 'margin': '10px auto'});
  };
  function openToc() {
    $(".main-content").css({'width': '65%', 'margin-right': '10px', 'margin-left': 'calc(35% - 350px)'});
    $(".toc-aside").css({'width': '300px', 'padding': '0 10px', 'transition': 'width 0.3s'});
    $(".toc-content").css({'width': '300px'});
    $(".toc-aside-title span, .toc-aside-title i").css({'display': 'inline-block'});
  }
  function openBtnClickFn () {
    let openOrCloseBtn = $('.toc-aside .toc-aside-title .toc-open-close');
    let open = eval('' || 'false');
    openOrCloseBtn.click(function() {
      if (open) {
        closeToc();
        open = false;
      } else {
        openToc();
        open = true;
      }
    });
  };
  openBtnClickFn();
  initCloseTocWidth(true);

  function initCloseTocWidth(init) {
    if (window.innerWidth >= 992) {
      let isClose = true;
      isClose && closeToc(init)
    }
  }

  document.addEventListener('pjax:complete', function () {
    $(".toc-aside").css({'transition': 'no'});
  })
  document.addEventListener('pjax:complete', function () {
    openBtnClickFn();
  })
  
</script>

  <!-- 图片放大 Wrap images with fancybox support -->
  <script src="/js/wrapImage.js"></script>
</div>

<!-- 文章详情页背景图 -->
<div id="appBgSwiper" style="position: fixed;left: 0;top: 0;width: 100%;height: 100%;z-index: -2;"
	:style="{'background-color': bgColor ? bgColor : 'transparent'}">
	<transition-group tag="ul" :name="names">
		<li v-for='(image,index) in img' :key='index' v-show="index === mark" class="bg-swiper-box">
			<img :src="image" class="bg-swiper-img no-lazy">
		</li>
	</transition-group>
</div>
<script>
	var vm = new Vue({
		el: '#appBgSwiper',
		data: {
			names: '' || 'fade' || 'fade', // translate-fade fade
			mark: 0,
			img: [],
			bgColor: '',
			time: null
		},
		methods: {   //添加方法
			change(i, m) {
				if (i > m) {
					// this.names = 'fade';
				} else if (i < m) {
					// this.names = 'fade';
				} else {
					return;
				}
				this.mark = i;
			},
			prev() {
				// this.names = 'fade';
				this.mark--;
				if (this.mark === -1) {
					this.mark = 3;
					return
				}
			},
			next() {
				// this.names = 'fade';
				this.mark++;
				if (this.mark === this.img.length) {
					this.mark = 0;
					return
				}
			},
			autoPlay() {
				// this.names = 'fade';
				this.mark++;
				if (this.mark === this.img.length) {
					this.mark = 0;
					return
				}
			},
			play() {
				let bgImgDelay = '' || '180000'
				let delay = parseInt(bgImgDelay) || 180000;
				this.time = setInterval(this.autoPlay, delay);
			},
			enter() {
				clearInterval(this.time);
			},
			leave() {
				this.play();
			}
		},
		created() {
			this.play()
		},
		beforeDestroy() {
			clearInterval(this.time);
		},
		mounted() {
			let prop = '' || 'https://pic4.zhimg.com/80/v2-5030587bac1b856d09e0a119ff6d7c04_1440w.jpg,https://api.btstu.cn/sjbz/api.php';
			let isImg = prop.includes('.bmp') || prop.includes('.jpg') || prop.includes('.png') || prop.includes('.tif') || prop.includes('.gif') || prop.includes('.pcx') || prop.includes('.tga') || prop.includes('.exif') || prop.includes('.fpx') || prop.includes('.psd') || prop.includes('.cdr') || prop.includes('.pcd') || prop.includes('.dxf') || prop.includes('.ufo') || prop.includes('.eps') || prop.includes('.ai') || prop.includes('.raw') || prop.includes('.WMF') || prop.includes('.webp') || prop.includes('.jpeg') || prop.includes('http://') || prop.includes('https://')
			if (isImg) {
				let img = prop.split(',');
				let configRoot = '/'
				let arrImg = [];
				img.forEach(el => {
					var Expression = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/;
					var objExp = new RegExp(Expression);

					if (objExp.test(el)) {
						// http or https
						arrImg.push(el);
					} else {
						// 非http or https开头
						// 本地文件
						let firstStr = el.charAt(0);
						if (firstStr == '/') {
							el = el.substr(1); // 删除第一个字符 '/',因为 configRoot最后一个字符为 /
						}
						el = configRoot + el;
						arrImg.push(el);
					}
				})
				this.img = arrImg;
			} else {
				this.bgColor = prop;
			}
		}
	})
</script>

<style>
	.bg-swiper-box {
		position: absolute;
		display: block;
		width: 100%;
		height: 100%;
	}

	.bg-swiper-img {
		object-fit: cover;
		width: 100%;
		height: 100%;
	}
</style>




  <script>
  function loadMermaid() {
    if (document.getElementsByClassName('mermaid').length) {
      if (window.mermaidJsLoad) mermaid.init()
      else {
        loadScript('https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.6.3/mermaid.min.js').then(() => {
          window.mermaidJsLoad = true
          mermaid.initialize({
            theme: 'default',
          })
          if ('true') {
            mermaid.init();
          }
        })
      }
    }
  };
  document.addEventListener("DOMContentLoaded", function () {
    loadMermaid();
  })

  document.addEventListener('pjax:complete', function () {
    loadMermaid();
  })
  
</script>


      </main>
    </div>

    <!-- 页脚 -->
    
  
  <!-- 底部鱼儿跳动效果，依赖于jquery-->
<div id="j-fish-skip" style=" position: relative;height: 153px;width: auto;"></div>
<script>
  var RENDERER = {
    POINT_INTERVAL: 5,
    FISH_COUNT: 3,
    MAX_INTERVAL_COUNT: 50,
    INIT_HEIGHT_RATE: .5,
    THRESHOLD: 50,
    FISH_COLOR: '',
    init: function () {
      this.setFishColor(); this.setParameters(), this.reconstructMethods(), this.setup(), this.bindEvent(), this.render()
    },
    setFishColor: function () {
      let isDark = JSON.parse(localStorage.getItem('dark')) || JSON.parse('false');
      if (isDark) {
        this.FISH_COLOR = '#222'; // 暗黑色，有时间把这整成一个变量
      } else {
        this.FISH_COLOR = '' || '#42b983';
      }
    },
    setParameters: function () {
      this.$window = $(window), this.$container = $("#j-fish-skip"), this.$canvas = $("<canvas />"), this.context = this.$canvas.appendTo(this.$container).get(0).getContext("2d"), this.points = [], this.fishes = [], this.watchIds = []
    },
    createSurfacePoints: function () {
      var t = Math.round(this.width / this.POINT_INTERVAL);
      this.pointInterval = this.width / (t - 1), this.points.push(new SURFACE_POINT(this, 0));
      for (var i = 1; i < t; i++) {
        var e = new SURFACE_POINT(this, i * this.pointInterval),
          h = this.points[i - 1];
        e.setPreviousPoint(h), h.setNextPoint(e), this.points.push(e)
      }
    },
    reconstructMethods: function () {
      this.watchWindowSize = this.watchWindowSize.bind(this), this.jdugeToStopResize = this.jdugeToStopResize.bind(this), this.startEpicenter = this.startEpicenter.bind(this), this.moveEpicenter = this.moveEpicenter.bind(this), this.reverseVertical = this.reverseVertical.bind(this), this.render = this.render.bind(this)
    },
    setup: function () {
      this.points.length = 0, this.fishes.length = 0, this.watchIds.length = 0, this.intervalCount = this.MAX_INTERVAL_COUNT, this.width = this.$container.width(), this.height = this.$container.height(), this.fishCount = this.FISH_COUNT * this.width / 500 * this.height / 500, this.$canvas.attr({
        width: this.width,
        height: this.height
      }), this.reverse = !1, this.fishes.push(new FISH(this)), this.createSurfacePoints()
    },
    watchWindowSize: function () {
      this.clearTimer(), this.tmpWidth = this.$window.width(), this.tmpHeight = this.$window.height(), this.watchIds.push(setTimeout(this.jdugeToStopResize, this.WATCH_INTERVAL))
    },
    clearTimer: function () {
      for (; this.watchIds.length > 0;) clearTimeout(this.watchIds.pop())
    },
    jdugeToStopResize: function () {
      var t = this.$window.width(),
        i = this.$window.height(),
        e = t == this.tmpWidth && i == this.tmpHeight;
      this.tmpWidth = t, this.tmpHeight = i, e && this.setup()
    },
    bindEvent: function () {
      this.$window.on("resize", this.watchWindowSize), this.$container.on("mouseenter", this.startEpicenter), this.$container.on("mousemove", this.moveEpicenter)
    },
    getAxis: function (t) {
      var i = this.$container.offset();
      return {
        x: t.clientX - i.left + this.$window.scrollLeft(),
        y: t.clientY - i.top + this.$window.scrollTop()
      }
    },
    startEpicenter: function (t) {
      this.axis = this.getAxis(t)
    },
    moveEpicenter: function (t) {
      var i = this.getAxis(t);
      this.axis || (this.axis = i), this.generateEpicenter(i.x, i.y, i.y - this.axis.y), this.axis = i
    },
    generateEpicenter: function (t, i, e) {
      if (!(i < this.height / 2 - this.THRESHOLD || i > this.height / 2 + this.THRESHOLD)) {
        var h = Math.round(t / this.pointInterval);
        h < 0 || h >= this.points.length || this.points[h].interfere(i, e)
      }
    },
    reverseVertical: function () {
      this.reverse = !this.reverse;
      for (var t = 0, i = this.fishes.length; t < i; t++) this.fishes[t].reverseVertical()
    },
    controlStatus: function () {
      for (var t = 0, i = this.points.length; t < i; t++) this.points[t].updateSelf();
      for (t = 0, i = this.points.length; t < i; t++) this.points[t].updateNeighbors();
      this.fishes.length < this.fishCount && 0 == --this.intervalCount && (this.intervalCount = this.MAX_INTERVAL_COUNT, this.fishes.push(new FISH(this)))
    },
    render: function () {
      requestAnimationFrame(this.render), this.controlStatus(), this.context.clearRect(0, 0, this.width, this.height), this.context.fillStyle = this.FISH_COLOR;
      for (var t = 0, i = this.fishes.length; t < i; t++) this.fishes[t].render(this.context);
      this.context.save(), this.context.globalCompositeOperation = "xor", this.context.beginPath(), this.context.moveTo(0, this.reverse ? 0 : this.height);
      for (t = 0, i = this.points.length; t < i; t++) this.points[t].render(this.context);
      this.context.lineTo(this.width, this.reverse ? 0 : this.height), this.context.closePath(), this.context.fill(), this.context.restore()
    }
  },
  SURFACE_POINT = function (t, i) {
    this.renderer = t, this.x = i, this.init()
  };
  SURFACE_POINT.prototype = {
    SPRING_CONSTANT: .03,
    SPRING_FRICTION: .9,
    WAVE_SPREAD: .3,
    ACCELARATION_RATE: .01,
    init: function () {
      this.initHeight = this.renderer.height * this.renderer.INIT_HEIGHT_RATE, this.height = this.initHeight, this.fy = 0, this.force = {
        previous: 0,
        next: 0
      }
    },
    setPreviousPoint: function (t) {
      this.previous = t
    },
    setNextPoint: function (t) {
      this.next = t
    },
    interfere: function (t, i) {
      this.fy = this.renderer.height * this.ACCELARATION_RATE * (this.renderer.height - this.height - t >= 0 ? -1 : 1) * Math.abs(i)
    },
    updateSelf: function () {
      this.fy += this.SPRING_CONSTANT * (this.initHeight - this.height), this.fy *= this.SPRING_FRICTION, this.height += this.fy
    },
    updateNeighbors: function () {
      this.previous && (this.force.previous = this.WAVE_SPREAD * (this.height - this.previous.height)), this.next && (this.force.next = this.WAVE_SPREAD * (this.height - this.next.height))
    },
    render: function (t) {
      this.previous && (this.previous.height += this.force.previous, this.previous.fy += this.force.previous), this.next && (this.next.height += this.force.next, this.next.fy += this.force.next), t.lineTo(this.x, this.renderer.height - this.height)
    }
  };
  var FISH = function (t) {
    this.renderer = t, this.init()
  };
  FISH.prototype = {
    GRAVITY: .4,
    init: function () {
      this.direction = Math.random() < .5, this.x = this.direction ? this.renderer.width + this.renderer.THRESHOLD : -this.renderer.THRESHOLD, this.previousY = this.y, this.vx = this.getRandomValue(4, 10) * (this.direction ? -1 : 1), this.renderer.reverse ? (this.y = this.getRandomValue(1 * this.renderer.height / 10, 4 * this.renderer.height / 10), this.vy = this.getRandomValue(2, 5), this.ay = this.getRandomValue(.05, .2)) : (this.y = this.getRandomValue(6 * this.renderer.height / 10, 9 * this.renderer.height / 10), this.vy = this.getRandomValue(-5, -2), this.ay = this.getRandomValue(-.2, -.05)), this.isOut = !1, this.theta = 0, this.phi = 0
    },
    getRandomValue: function (t, i) {
      return t + (i - t) * Math.random()
    },
    reverseVertical: function () {
      this.isOut = !this.isOut, this.ay *= -1
    },
    controlStatus: function (t) {
      this.previousY = this.y, this.x += this.vx, this.y += this.vy, this.vy += this.ay, this.renderer.reverse ? this.y > this.renderer.height * this.renderer.INIT_HEIGHT_RATE ? (this.vy -= this.GRAVITY, this.isOut = !0) : (this.isOut && (this.ay = this.getRandomValue(.05, .2)), this.isOut = !1) : this.y < this.renderer.height * this.renderer.INIT_HEIGHT_RATE ? (this.vy += this.GRAVITY, this.isOut = !0) : (this.isOut && (this.ay = this.getRandomValue(-.2, -.05)), this.isOut = !1), this.isOut || (this.theta += Math.PI / 20, this.theta %= 2 * Math.PI, this.phi += Math.PI / 30, this.phi %= 2 * Math.PI), this.renderer.generateEpicenter(this.x + (this.direction ? -1 : 1) * this.renderer.THRESHOLD, this.y, this.y - this.previousY), (this.vx > 0 && this.x > this.renderer.width + this.renderer.THRESHOLD || this.vx < 0 && this.x < -this.renderer.THRESHOLD) && this.init()
    },
    render: function (t) {
      t.save(), t.translate(this.x, this.y), t.rotate(Math.PI + Math.atan2(this.vy, this.vx)), t.scale(1, this.direction ? 1 : -1), t.beginPath(), t.moveTo(-30, 0), t.bezierCurveTo(-20, 15, 15, 10, 40, 0), t.bezierCurveTo(15, -10, -20, -15, -30, 0), t.fill(), t.save(), t.translate(40, 0), t.scale(.9 + .2 * Math.sin(this.theta), 1), t.beginPath(), t.moveTo(0, 0), t.quadraticCurveTo(5, 10, 20, 8), t.quadraticCurveTo(12, 5, 10, 0), t.quadraticCurveTo(12, -5, 20, -8), t.quadraticCurveTo(5, -10, 0, 0), t.fill(), t.restore(), t.save(), t.translate(-3, 0), t.rotate((Math.PI / 3 + Math.PI / 10 * Math.sin(this.phi)) * (this.renderer.reverse ? -1 : 1)), t.beginPath(), this.renderer.reverse ? (t.moveTo(5, 0), t.bezierCurveTo(10, 10, 10, 30, 0, 40), t.bezierCurveTo(-12, 25, -8, 10, 0, 0)) : (t.moveTo(-5, 0), t.bezierCurveTo(-10, -10, -10, -30, 0, -40), t.bezierCurveTo(12, -25, 8, -10, 0, 0)), t.closePath(), t.fill(), t.restore(), t.restore(), this.controlStatus(t)
    }
  }, $(function () {
    RENDERER.init()
    $('.dark').click(function () {
      setTimeout(() => {
        RENDERER.setFishColor();
        RENDERER.context.fill();
      });
    })
  });
</script>
  <div class="footer bg-color">
    <div class="footer-main">
      
        
          <div class="link">
            
              
                <a href="mailto:2985409357@qq.com" class="social">
                  
                    <i class="fa fa-envelope" aria-hidden="true"></i>
                  
                </a>
              
            
              
                <a target="_blank" rel="noopener" href="https://github.com/yangyang-linux" class="social">
                  
                    <i class="fab fa-github" aria-hidden="true"></i>
                  
                </a>
              
            
              
                <a href="tencent://AddContact/?fromId=50&amp;fromSubId=1&amp;subcmd=all&amp;uin=2985409357" class="social">
                  
                    <i class="fab fa-qq" aria-hidden="true"></i>
                  
                </a>
              
            
          </div>
        
      
        
          <div class="footer-copyright">
            <p>Copyright © 2019 - <span id="display_copyright_time"></span> <a target="_blank" rel="noopener" href="https://gitee.com/yangyang-linux">yangyang-linux</a> | Powered by <a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/">Hexo</a> | Theme <a target="_blank" rel="noopener" href="https://github.com/yuang01/theme">Bamboo</a></p>

          </div>
        
      
        
          
            <!-- 不蒜子统计 -->
            <!-- 不蒜子统计 -->
<span id="busuanzi_container_site_pv">
      <i class="fas fa-eye" aria-hidden="true"></i>本站总访问量：<span id="busuanzi_value_site_pv"></span> 次
</span>
<span class="post-meta-divider">|</span>
<span id="busuanzi_container_site_uv" style='display:none'>
      <i class="fas fa-users" aria-hidden="true"></i>本站访客数：<span id="busuanzi_value_site_uv"></span> 人
</span>

          
        
      
        
          <div class="footer-custom">
            
              <div><p><span>本博客已萌萌哒地运行</span><span id="display_live_time"></span></p>
</div>
            
          </div>
        
      
		</br>
		</br>
		</br>
    </div>
  </div>



    <!-- 渲染暗黑按钮 -->
    
      <div class="dark">
  <div class="dark-content">
    <i class="fas fa-moon" aria-hidden="true"></i>
    <!-- <span>关灯</span> -->
  </div>
  
</div>

<script>
  $(function() {
    let isDark = JSON.parse(localStorage.getItem('dark'))  || JSON.parse('false');
    if (isDark) {
      $(".dark-content").replaceWith(
          `
          <div class='dark-content'>
            <i class="fas fa-lightbulb" aria-hidden="true"></i>
          </div>
          `
        );
    }
    $('.dark').click(function() {
      if ($(document.body).is('.darkModel')) {
        $(document.body).removeClass('darkModel');
        localStorage.setItem('dark', false);
        $(".dark-content").replaceWith(
          `
          <div class='dark-content'>
            <i class="fas fa-moon" aria-hidden="true"></i>
          </div>
          `
        );
      } else {
        $(document.body).addClass('darkModel');
        localStorage.setItem('dark', true);
        $(".dark-content").replaceWith(
          `
          <div class='dark-content'>
            <i class="fas fa-lightbulb" aria-hidden="true"></i>
          </div>
          `
        );
      }
    })
  })
</script>
    
    <!-- 渲染回到顶部按钮 -->
    
      <div class="goTop top-btn-color" pointer>
  <i class="fas fa-arrow-up" aria-hidden="true"></i>
</div>
<script src="/js/goTop.js"></script>

    
    <!-- 渲染左下角音乐播放器 -->
    
      <link rel="stylesheet" href="/js/aplayer/APlayer@1.10.1.min.css">
<style>
.aplayer .aplayer-lrc p {
  
  font-size: 12px;
  font-weight: 700;
  line-height: 16px !important;
}

.aplayer .aplayer-lrc p.aplayer-lrc-current {
  
  font-size: 15px;
  color: #C90041;
}


.aplayer.aplayer-fixed.aplayer-narrow .aplayer-body {
  left: -66px !important;
}

.aplayer.aplayer-fixed.aplayer-narrow .aplayer-body:hover {
  left: 0px !important;
}


</style>
<meting-js  
  class=""
  server="netease"
  type="playlist"
  id="5300120281"
  fixed='true'
  autoplay='true'
  theme='#C90041'
  loop='all'
  order='random'
  preload='auto'
  volume='0.4'
  list-folded='true'
>
</meting-js>

<!-- <style>
  #aplayer {
    position: fixed;
    left: 0;
    bottom: 300px;
  }
</style> -->
<script src="https://unpkg.com/aplayer@1.10.1/dist/APlayer.min.js"></script>
<script src="https://unpkg.com/meting@2/dist/Meting.min.js"></script>
    

    <!-- 图片放大 -->
    
      <script src="/js/fancybox/jquery.fancybox.min.js"></script>
    

    <!-- 百度解析 -->
    <!-- Baidu Analytics -->

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    <!-- 背景彩带 -->
    
      <script type="text/javascript" size="100" alpha='0.4' zIndex="-1" src="/js/ribbon.min.js"></script>
    

    <script src="/js/utils/index.js"></script>
    <script src="/js/app.js"></script>
    
    <!-- 文章目录所需js -->
<link href="/js/tocbot/tocbot.css" rel="stylesheet">
<script src="/js/tocbot/tocbot.min.js"></script>

<script>
  var headerEl = 'h1, h2, h3, h4, h5, h6',  //headers 
    content = '.post-detail',//文章容器
    idArr = {};  //标题数组以确定是否增加索引id
  //add #id
  var option = {
    // Where to render the table of contents.
    tocSelector: '.toc',
    // Where to grab the headings to build the table of contents.
    contentSelector: content,
    // Which headings to grab inside of the contentSelector element.
    headingSelector: headerEl,
    scrollSmooth: true,
    scrollSmoothOffset: -80,
    headingsOffset: -($(window).height() * 0.4 - 45),
    positionFixedSelector: '.toc-main',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto',
    activeLinkClass: 'is-active-link',
    // onClick: function (e) {},
  }
  if ($('.toc').length > 0) {

    $(content).children(headerEl).each(function () {
      //去除空格以及多余标点
      var headerId = $(this).text().replace(/[\s|\~|`|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\_|\+|\=|\||\|\[|\]|\{|\}|\;|\:|\"|\'|\,|\<|\.|\>|\/|\?|\：|\，|\。]/g, '');

      headerId = headerId.toLowerCase();
      if (idArr[headerId]) {
        //id已经存在
        $(this).attr('id', headerId + '-' + idArr[headerId]);
        idArr[headerId]++;
      }
      else {
        //id未存在
        idArr[headerId] = 1;
        $(this).attr('id', headerId);
      }
    });

    document.addEventListener("DOMContentLoaded", function () {
      tocbot.init(option);
      mobileTocClick();
    });

  }

  window.tocScrollFn = function () {
    return bamboo.throttle(function () {
      findHeadPosition();
    }, 100)()
  }
  window.addEventListener('scroll', tocScrollFn);

  const findHeadPosition = function (top) {
    if ($('.toc-list').length <= 0) {
      return false;
    }
    setTimeout(() => {  // or DOMContentLoaded 
      autoScrollToc();
    }, 0);
  }

  const autoScrollToc = function () {
    const $activeItem = document.querySelector('.is-active-link');
    const $cardToc = document.querySelector('.toc-content');
    const activePosition = $activeItem.getBoundingClientRect().top
    const sidebarScrollTop = $cardToc.scrollTop
    if (activePosition > (document.documentElement.clientHeight - 100)) {
      $cardToc.scrollTop = sidebarScrollTop + 150
    }
    if (activePosition < 100) {
      $cardToc.scrollTop = sidebarScrollTop - 150
    }
  }

  document.addEventListener('pjax:send', function () {
    if ($('.toc').length) {
      tocbot.destroy();
    }
  });

  document.addEventListener('pjax:complete', function () {
    if ($('.toc').length) {
      tocbot.init(option);
      mobileTocClick();
    }
  });
  
  // 手机端toc按钮点击出现目录
  const mobileTocClick = function () {
    const $cardTocLayout = document.getElementsByClassName('toc-aside')[0];
    const $cardToc = $cardTocLayout.getElementsByClassName('toc-content')[0];
    let right = '45px';
    if (window.innerWidth >= 551 && window.innerWidth <= 992) {
      right = '100px'
    }
    const mobileToc = {
      open: () => {
        $cardTocLayout.style.cssText = 'animation: toc-open .3s; opacity: 1; right: ' + right
      },

      close: () => {
        $cardTocLayout.style.animation = 'toc-close .2s'
        setTimeout(() => {
          $cardTocLayout.style.cssText = "opacity:''; animation: ''; right: ''"
        }, 100)
      }
    }
    document.getElementById('toc-mobile-btn').addEventListener('click', () => {
      if (window.getComputedStyle($cardTocLayout).getPropertyValue('opacity') === '0') mobileToc.open()
      else mobileToc.close()
    })

    $cardToc.addEventListener('click', (e) => {
      if (window.innerWidth < 992) { // 小于992px的时候
        mobileToc.close()
      }
    })
  }
</script>

<style>
  .is-position-fixed {
    position: sticky !important;
    top: 74px;
  }

  .toc-main ul {
    counter-reset: show-list;
  }

  .toc-main ul li::before {
    content: counter(item)".";
    display: block;
    position: absolute;
    left: 12px;
    top: 0;
  }
</style> 

<!-- 设置导航背景 -->
<script>
  let setHeaderClass = () => {
    const headerMenuTransparent = true;
    if (!headerMenuTransparent) { return; }
    const nav = $('#navHeader');
    const navTop = nav.outerHeight();
    const winTop = $(window).scrollTop();
    if(winTop > navTop) {
      nav.addClass('header-bg-color');
    }
    else {
      nav.removeClass('header-bg-color');
    }
  };

  let scrollCollect = () => {
    return bamboo.throttle(function (e) {
      setHeaderClass();
    }, 200)()
  }

  let initHeaderBg = () => {
    setHeaderClass();
  }

  setHeaderClass();
  window.addEventListener('scroll', scrollCollect);

  document.addEventListener('pjax:send', function () {
    window.removeEventListener('scroll', scrollCollect)
  })
  document.addEventListener('pjax:complete', function () {
    window.addEventListener('scroll', scrollCollect);
    setHeaderClass();
  })
</script> 

<!-- 渲染issues标签里的内容 -->
<script>
  function loadIssuesJS() {
    if ($(".post-detail").find(".issues-api").length == 0) {
      return;
    } 
    loadScript('/js/issues/index.js');
  };
  $(function () {
    loadIssuesJS();
  });
  document.addEventListener('pjax:complete', function () {
    if (typeof IssuesAPI == "undefined") {
      loadIssuesJS();
    }
  })
</script>

<!-- 输入框打字特效 -->
<!-- 输入框打字特效 -->

  <script src="/js/activate-power-mode.js"></script>
  <script>
    POWERMODE.colorful = true;  // 打开随机颜色特效
    POWERMODE.shake = false;    // 关闭输入框抖动
    document.body.addEventListener('input', POWERMODE);//监听打字事件
  </script>


<!-- markdown代码一键复制功能 -->

  <link rel="stylesheet" href="https://unpkg.com/v-plugs-ayu/lib/ayu.css">
  <script src="https://unpkg.com/v-plugs-ayu/lib/ayu.umd.min.js"></script>
  <script src="/js/clipboard/clipboard.min.js"></script>
  <div id="appCopy">
  </div>
  <script data-pjax>
    var vm = new Vue({
      el: '#appCopy',
      data: {
      },
      computed: {
      },
      mounted() {
        const that = this;
        var copy = '复制';
        /* code */
        var initCopyCode = function () {
          var copyHtml = '';
          copyHtml += '<button class="btn-copy" data-clipboard-snippet="" style="position:absolute;top:0;right:0;z-index:1;">';
          copyHtml += '<i class="fas fa-copy"></i><span>' + copy + '</span>';
          copyHtml += '</button>';
          $(".post-detail pre").not('.gutter pre').wrap("<div class='codeBox' style='position:relative;width:100%;'></div>")
          $(".post-detail pre").not('.gutter pre').before(copyHtml);
          new ClipboardJS('.btn-copy', {
            target: function (trigger) {
              return trigger.nextElementSibling;
            }
          });
        }
        initCopyCode();
        $('.btn-copy').unbind('click').bind('click', function () {
          doSomething();
        })
        $(document).unbind('keypress').bind('keypress', function (e) {
          if (e.ctrlKey && e.keyCode == 67) {
            doSomething();
          }
        })

        function doSomething() {
          that.$notify({
            title: "成功",
            content: "代码已复制，请遵守相关授权协议。",
            type: 'success'
          })
        }
      },
      methods: {
      },
      created() { }
    })
  </script>
  

<!-- 图片懒加载 -->
<script defer src="https://unpkg.com/vanilla-lazyload@17.1.0/dist/lazyload.min.js"></script>
<script>
  // https://www.npmjs.com/package/vanilla-lazyload
  // Set the options globally
  // to make LazyLoad self-initialize
  window.lazyLoadOptions = {
    elements_selector: ".lazyload",
    threshold: 0
  };
  // Listen to the initialization event
  // and get the instance of LazyLoad
  window.addEventListener(
    "LazyLoad::Initialized",
    function (event) {
      window.lazyLoadInstance = event.detail.instance;
    },
    false
  );
  document.addEventListener('DOMContentLoaded', function () {
    lazyLoadInstance.update();
  });
  document.addEventListener('pjax:complete', function () {
    lazyLoadInstance.update();
  });
</script>


<!-- 卡片滚动动画 -->

    <script type="text/javascript">
  loadScript("https://unpkg.com/scrollreveal@4.0.6/dist/scrollreveal.min.js")
  function pjax_scrollrebeal() {
    ScrollReveal().reveal('.reveal', {
      distance: '120px',
      duration: '400',
      interval: '30',
      scale: '1',
      origin: 'bottom', // 动画开始的方向
      easing: 'ease'
    });
  }
  $(function () {
    var checkScrollReveal = setInterval(function () {
      if ($("#safearea").css("display") != "block") return
      if (typeof ScrollReveal == "undefined") return
      clearInterval(checkScrollReveal)
      pjax_scrollrebeal();
    }, 100)
  });
  document.addEventListener('pjax:complete', function () {
    pjax_scrollrebeal();
  })
</script>
   

<!-- 评论所需js -->

  
    <!-- 弹幕所需的css和js -->
    
  <!-- 弹幕插件 -->
  <link href="/js/danmu/barrager.css" rel="stylesheet">
  <script src="/js/danmu/jquery.barrager.js"></script>

<!-- 具体js，请前往valine/script.ejs查看 -->

    <script>
  var requiredFields = 'nick';
  requiredFields = requiredFields.split(',');
  comment_el = '.comment';
  let looperValine = null;
  load_valine = function () {
    if ($(comment_el).length) {
      var valine = new Valine({
        el: '#vcomment',
        path: window.location.pathname,
        notify: false,
        verify: false,
        app_id: "HvvYcruryPsiW2egxIpRnlKV-gzGzoHsz",
        app_key: "MLKN1tH2RNDMR4e3O9PJgAh5",
        placeholder: "客官，说点什么吧（如果想让我及时收到的话可以连续发送两遍，会触发邮件提醒机制）",
        avatar: "wavatar",
        master: "3d28ff93d17df2e86f7971eda5159791",   //博主邮箱md5
        tagMeta: ["博主","小伙伴","访客"],     //标识字段名
        friends: "8b42635701290c05327f3faba356ce6e",
        metaPlaceholder: { "nick": "昵称/QQ号", "mail": "邮箱" },
        requiredFields: requiredFields,
        enableQQ: true,
      });
      function debounce(fn) {
        var timerID = null
        return function () {
          var arg = arguments[0]   //获取事件
          if (timerID) {
            clearTimeout(timerID)
          }
          timerID = setTimeout(function () {
            fn(arg)              //事件传入函数
          }, 200)
        }
      }
      //查询评论 valine.Q('*').limit(7) -- 查询所有，限制7条, 下面的的代码是查询当前页面
      var themeDanmu = eval('true');
      var themeLoop = eval('false');
      var themeLooperTime = '5000' || 5000;
      var speed = '20' || 20;
      var isBarrager = true;
      if (themeDanmu == true) {
        do_barrager();
        if ($('.danmuBox').length <= 0) {
          $('.navbar').append('<div class="danmuBox"><div class="danmuBtn open"><span class="danmuCircle"></span><span class="danmuText">弹幕</span></div></div>');
        }
        $('.danmuBtn').on('click', debounce(
          function () {
            if ($('.danmuBtn').hasClass('open')) {
              $('.danmuBtn').removeClass('open')
              clearInterval(looperValine);
              $.fn.barrager.removeAll();
            } else {
              $('.danmuBtn').addClass("open");
              do_barrager();
            }
          }
        ))
      }
      function do_barrager() {
        isBarrager && valine.Q(window.location.pathname).find().then(function (comments) {
          // var num = 0; // 可以记录条数，循环调用的时候只取最新的评论放入弹幕中
          var run_once = true;
          var looper_time = themeLooperTime;
          var total = comments.length;
          // var looper = null;
          var index = 0;
          if (total > 0) {
            barrager();
          } else {
            // 当评论数为0的时候，自动关闭弹幕
            // $('.danmuBtn').removeClass('open');
          }
          function barrager() {
            if (run_once) {
              //如果是首次执行,则设置一个定时器,并且把首次执行置为false
              looperValine = setInterval(barrager, looper_time);
              run_once = false;
            }
            var content = comments[index]._serverData.comment;
            var email = comments[index]._serverData.mail;
            var link = comments[index]._serverData.link;
            var newcontent = content.substring(0, 50).replace(/<[^>]+>/g, "");
            //发布一个弹幕
            const item = {
              img: `https://q1.qlogo.cn/g?b=qq&nk=${email}&s=640`, //图片 
              info: newcontent, //文字 
              href: link, //链接 
              close: true, //显示关闭按钮 
              speed: speed, //延迟,单位秒,默认6 
              color: '#fff', //颜色,默认白色 
              old_ie_color: '#000000', //ie低版兼容色,不能与网页背景相同,默认黑色
            }
            $('body').barrager(item);
            //索引自增
            index++;
            //所有弹幕发布完毕，清除计时器。
            if (index == total) {
              clearInterval(looperValine);
              if (themeLoop === true) {
                setTimeout(function () {
                  do_barrager();
                }, 5000);
              } else {
                $('.danmuBtn').removeClass('open');
              }
              return false;
            }

          }
        })
      }
    }
  };
  $(document).ready(load_valine);
  document.addEventListener('pjax:send', function (e) {
    
      $('.danmuBox').length > 0 && $('.danmuBox').remove()
      looperValine && clearInterval(looperValine);
      $.fn.barrager.removeAll();
    
  })
  document.addEventListener('pjax:complete', function () {
    load_valine();
  });
</script>

  


<!-- 鼠标点击特效 -->
<!-- 爱心点击 -->

  
    <script src="/js/cursor/fireworks.js"></script>
  




  <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" data-pjax></script>


    <!-- pjax -->
    

<!-- pjax -->


  <script src="/js/pjax@0.2.8/index.js"></script>
  
    <!-- 样式位于：source/css/_third-party/pjaxanimate.styl -->

<div class="pjax-animate">
  
    <div class="loading-circle"><div id="loader-circle"></div></div>
    <script>
      window.ShowLoading = function() {
        $(".loading-circle").css("display", "block");
      };
      window.HideLoading = function() {
        $(".loading-circle").css("display", "none");
      }
    </script>
  
	<script>
    document.addEventListener('pjax:complete', function () {
      window.HideLoading();
    })
    document.addEventListener('pjax:send', function () {
      window.ShowLoading();
    })
    document.addEventListener('pjax:error', function () {
      window.HideLoading();
    })
	</script>
</div>

  

  <script>
    var pjax = new Pjax({
      elements: 'a[href]:not([href^="#"]):not([href="javascript:void(0)"]):not([no-pjax])',   // 拦截正常带链接的 a 标签
      selectors: ["#pjax-container","title"],                                   // 根据实际需要确认重载区域
      cacheBust: false,   // url 地址追加时间戳，用以避免浏览器缓存
      timeout: 5000
    });

    document.addEventListener('pjax:send', function (e) {

      try {
        var currentUrl = window.location.pathname;
        var targetUrl = e.triggerElement.href;
        var banUrl = [""];
        if (banUrl[0] != "") {
          banUrl.forEach(item => {
            if(currentUrl.indexOf(item) != -1 || targetUrl.indexOf(item) != -1) {
              window.location.href = targetUrl;
            }
          });
        }
      } catch (error) {}

      $(window).unbind('resize');
      $(window).unbind('scroll');
      $(document).unbind('scroll');
      $(document).unbind('click');
      $('body').unbind('click');

    })
    
    document.addEventListener('pjax:complete', function () {
      $('script[data-pjax], .pjax-reload script').each(function () {
        $(this).parent().append($(this).remove());
      });
    });

    document.addEventListener('pjax:error', function (e) {
      window.location.href = e.triggerElement.href;
    })
    
    // 刷新不从顶部开始
    document.addEventListener("DOMContentLoaded", function () {
      history.scrollRestoration = 'auto';
    })
  </script>



  </body>
</html>